This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes JSP and BEANS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP and BEANS" Watch "JSP and BEANS" New topic
Author

JSP and BEANS

vasudha prabhala
Greenhorn

Joined: Jan 07, 2003
Posts: 5
the following are the three files that I am using and i get the following message
GetName.html
<HTML>
<BODY>
<FORM METHOD=POST ACTION="SaveName1.jsp">
What's your name? <INPUT TYPE=TEXT NAME=username SIZE=20><BR>
What's your e-mail address? <INPUT TYPE=TEXT NAME=email SIZE=20><BR>
What's your age? <INPUT TYPE=TEXT NAME=age SIZE=4>
<P><INPUT TYPE=SUBMIT>
</FORM>
</BODY>
</HTML>
Savename1.jsp
<jsp:useBean id="user" class="UserData" scope="session"/>
<jsp:setProperty name="user" property="*"/>
<HTML>
<BODY>
<A HREF="NextPage1.jsp">Continue</A>
</BODY>
</HTML>
NextPage1.jsp

<jsp:useBean id="user" class="UserData" scope="session"/>
<HTML>
<BODY>
You entered<BR>
Name: <%= user.getUsername() %><BR>
Email: <%= user.getEmail() %><BR>
Age: <%= user.getAge() %><BR>
</BODY>
</HTML>
I have my class UserDate.Class in c:\myfolder\myclasses. and I have added this to the classpath. I am using tomcat 3.3.1 and JDK 1.4 is installed on my system. I am using servlet 2.2 and jsp 1.1 . why am I getting the following error.. please help..
Error: 500
Location: /examples/jsp/myfiles/SaveName1.jsp
Internal Servlet Error:
org.apache.jasper.JasperException: Unable to compile Note: sun.tools.javac.Main has been deprecated.
C:\vasudha\tomcat\jakarta-tomcat-3.3.1\work\DEFAULT\examples\jsp\myfiles\SaveName1_1.java:52: Class jsp.myfiles.UserData not found.
UserData user = null;
^
C:\vasudha\tomcat\jakarta-tomcat-3.3.1\work\DEFAULT\examples\jsp\myfiles\SaveName1_1.java:55: Class jsp.myfiles.UserData not found.
user= (UserData)
^
C:\vasudha\tomcat\jakarta-tomcat-3.3.1\work\DEFAULT\examples\jsp\myfiles\SaveName1_1.java:60: Class jsp.myfiles.UserData not found.
user = (UserData) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "UserData");
^
3 errors, 1 warning
at org.apache.tomcat.facade.JasperLiaison.javac(JspInterceptor.java:898)
at org.apache.tomcat.facade.JasperLiaison.processJspFile(JspInterceptor.java:733)
at org.apache.tomcat.facade.JspInterceptor.requestMap(JspInterceptor.java:506)
at org.apache.tomcat.core.ContextManager.processRequest(ContextManager.java:968)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:875)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:833)
at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:176)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:494)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:516)
at java.lang.Thread.run(Thread.java:536)
Deepak MP
Greenhorn

Joined: Dec 01, 2002
Posts: 11
I have my class UserDate.Class in c:\myfolder\myclasses. and I have added this to the classpath. I am using tomcat 3.3.1 and JDK 1.4 is installed on my system. I am using servlet 2.2 and jsp 1.1 . why am I getting the following error.. please help..
PUT THE UserData.class in WEB-INF FOLDER.
DEEPAK
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
This has got to be one of the most common problems with JSP. To avoid bizarre problems like this - instead of:
<jsp:useBean id="user" class="UserData" scope="session"/>
You MUST put your class in a package and include the package name in the tag:
<jsp:useBean id="user" class="mypkg.UserData" scope="session"/>
You MUST also import the package and put the class files under WEB-INF/classes just like servlet classes.
The reason is that without a package, the compiler and servlet engine will look in the "current" directory - you have not control over what the "current" directory is.
Bill
[ January 11, 2003: Message edited by: William Brogden ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP and BEANS
 
Similar Threads
problem with bean in tomcat
Tomcat 4.11 doubt
Need help with jsp page so that it calls a good working bean
Unable to compile class for JSP
Where to put bean class in Tomcat?