Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error while calling beans in jsp

 
Trident Executive
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody,I'm having problem while calling bean class in my jsp e.g. <jsp:useBean id="user" class="UserData" scope="session"/> gives me an error that "cannot resolve symbol : class UserData",i'm keeping my UserData.class in web-inf\classes directory and have set the classpath in system as well as in catalina.bat.
Plz suggest me the possible solution asap.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Trident Executive",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp.
We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please edit your profile and select a new name which meets the requirements.
Thanks.
Dave
 
Sudharsan Govindarajan
Ranch Hand
Posts: 319
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't u have a package structure for ur classes. If you dont have, putting your classes into some package will avoid lot of frustrations like this.
 
Ron Newman
Ranch Hand
Posts: 1056
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This needs to be an FAQ somewhere. A bean class used in a JSP must be in a package.
 
Garry Jackson
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've actually managed to include a bean outside of a package using the import statement in the jsp, for example:-
<%@ page language="java" import="iBean" %>
The bean class just sits in the WAR structure under WEB-INF/classes
 
Ron Newman
Ranch Hand
Posts: 1056
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That will work in Java 1.3 but not in 1.4.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic