This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes JSP and the fly likes Jsp not accessing bean class ! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "Jsp not accessing bean class !" Watch "Jsp not accessing bean class !" New topic
Author

Jsp not accessing bean class !

Ghazala Islam
Ranch Hand

Joined: Nov 22, 2000
Posts: 73
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

Joined: Mar 07, 2002
Posts: 1427
The error message is clear ... You need to say:
public class accesscountbean {
... ...
}


Seam Framework: http://www.amazon.com/exec/obidos/ASIN/0137129394/mobileenterpr-20/
Ringful: http://www.ringful.com/
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Jsp not accessing bean class !