Search code examples
jspjsp-tags

org.apache.jasper.JasperException: jsp:getProperty for bean with name 'BasicPOJO'. Name was not previously introduced as per JSP.5.3


I am getting following error while running a JSP page:

org.apache.jasper.JasperException: jsp:getProperty for bean with name 'BasicPOJO'. Name was not previously introduced as per JSP.5.3

My code is as follows:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
  </head>
  <body>
    <jsp:useBean id="basic" scope="session" class="BasicPOJO">
      <jsp:setProperty name="basic" property="userid" param="guiuserid"></jsp:setProperty>
    </jsp:useBean>
    <h1>Welcome <jsp:getProperty name="BasicPOJO" property="userid"/></h1>
  </body>
</html>

I am using Apache Tomcat 5.5.33 on Windows 7. I have found Tomcat issue 47822 which indicates that it is a bug in Tomcat. How can I solve this?


Solution

  • Put the bean class in a package.

    Classes in the default package are invisible to other classes which are by itself inside a package (such as the generated JSP class).