File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jsp not accessing bean class !

 
Ghazala Islam
Ranch Hand
Posts: 73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I 'm having error running jsp which access a bean class.
the error is :
" Can't access class beans.accesscountbean. Class or interface must be public, in same package, or an accessible member class."
My bean class code is :
-------------------------
package beans;
class accesscountbean {
private String firstPage;
private int accessCount = 1;
public String getFirstPage() {
return(firstPage); }
public void setFirstPage(String fp) {
this.firstPage = fp;
}
public int getAccessCount() {
return(accessCount++) ; }
}
---------------------------
Jsp is :
---------------------------
<html>
<body>
<jsp:useBean id="counter"
class = "beans.accesscountbean"
scope="application">
<jsp:setProperty name="counter"
property="firstPage"
value="SharedCounts1.jsp" />
</jsp:useBean>
of SharedCounts1.jsp(this page),
<A href="sdfsd.jsp">New Page </a>,
<jsp:getProperty name="counter"
property = "firstPage" />
was the first page accessed.
<p>
Collectively the has been accessed
<jsp:getProperty name="counter"
property="accessCount" />
</body>
</html>
------------------------------------------
Bean is stored in following directory :
c:\tomcat/webapps/examples/web-inf/classes/beans
 
Michael Yuan
author
Ranch Hand
Posts: 1427
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The error message is clear ... You need to say:
public class accesscountbean {
... ...
}
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic