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
posted
0
The error message is clear ... You need to say: public class accesscountbean { ... ... }