• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Jsp not accessing bean class !

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author
Posts: 1436
6
Python TypeScript Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The error message is clear ... You need to say:
public class accesscountbean {
... ...
}
reply
    Bookmark Topic Watch Topic
  • New Topic