tags:

views:

75

answers:

1

I have the class A:

package a;

public class A {
private int x = 9;

public int getX() {
    return x;
}
}

and the ajsp.jsp file:

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<jsp:useBean id = "a" class = "a.A" />
<c:out value = "${a.x}" />
</body>
</html>

when i run it, it gives an error :

  • org.apache.jasper.JasperException: /ajsp.jsp(11,0) PWC6236: According to TLD or attribute directive in tag file, attribute value does not accept any expressions

if instead of <c:out value = "${a.x}" /> i use <jsp:getProperty property="x" name="a"/> it goes perfect. So, what is the problem? Thank advance.

+1  A: 

Your taglib URI is incorrect, you're using the URI of the old pre-expression, pre-JSP 2.0 library.

Instead of

http://java.sun.com/jstl/core

it should be

http://java.sun.com/jsp/jstl/core

skaffman
Thank you. Very much:)
artaxerxe
As a hint, don't read JSP/JSTL books/tutorials dated before 2006 ;) If you're reading online tutorials, put roseindia.net in ignore list. This is a good one: http://courses.coreservlets.com/Course-Materials/csajsp2.html
BalusC
Very good. I just done the specified mistake... Your link is very good. Thanks for all.
artaxerxe