Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes JSP and the fly likes Error In Bean PageScope Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Error In Bean PageScope" Watch "Error In Bean PageScope" New topic
Author

Error In Bean PageScope

Gaurav x Jain
Ranch Hand

Joined: Feb 01, 2011
Posts: 39
I am facing an Error while using Bean for Page Scope is as follows:

Error:
------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Cannot find any information on property 'count' in a bean of type 'JSPTest.TestBeanPageScope'
org.apache.jasper.runtime.JspRuntimeLibrary.getReadMethod(JspRuntimeLibrary.java:839)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1057)
org.apache.jasper.compiler.Node$GetProperty.accept(Node.java:1124)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2417)
org.apache.jasper.compiler.Node$Root.accept(Node.java:495)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
org.apache.jasper.compiler.Generator.generate(Generator.java:3416)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:231)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:347)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


note The full stack trace of the root cause is available in the Apache Tomcat/6.0.26 logs.




this is a JSP page (BeanPageScope.JSP)
---------------------------------------
%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>

<jsp:useBean id="testPageScope" class="JSPTest.TestBeanPageScope" scope="page"/>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@page import="JSPTest.TestBeanPageScope"%><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Bean page Scope</title>
</head>
<body>
<%
testPageScope.setCounter(testPageScope.getCounter()+1);

%>

The value of counter is:
<jsp:getProperty name="testPageScope" property="count" />
</body>
</html>

This is a Java Class File (TestBeanPageScope.java)
---------------------------------------------------
package JSPTest;

public class TestBeanPageScope {

public int count;

public void setCounter(int count)
{
this.count=count;
}

public int getCounter()
{
return count++;
}
}

-----

Please help what I have to do. I think I am making a little bit mistake.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

There is no property named count in your bean. Note that an instance variable is not a bean property.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Shanky Sohar
Ranch Hand

Joined: Mar 17, 2010
Posts: 1051

you dont have count property in your bean...
It should be counter


SCJP6.0,My blog Ranchers from Delhi
Gaurav x Jain
Ranch Hand

Joined: Feb 01, 2011
Posts: 39
Thank you very much. Now Bean Property related my myths and Confusions solved. Thank you for your support
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error In Bean PageScope
 
Similar Threads
make Simple Tag with attribute
jspuseBean error??
Beans in JSP
jsp cannot call bean in websphere application server
getting variable value