Where is the class relative to the jsp?
Recheck the docs. I'm not 100% sure, but I think it needs to be in the Web-inf\classes
directory under the web app's document root or in your system's classpath.
Larry
>>> [EMAIL PROTECTED] 04/07/01 10:45AM >>>
Hello,
I am using Tomcat 3.2 with Windows 2000.
I was trying to implement a jsp tutorial example using HTML forms and
beans. The code is as follows.
GetName.html
<HTML>
<BODY>
<FORM METHOD=POST ACTION="SaveName.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>
UserData.java
public class UserData {
String username;
String email;
int age;
public void setUsername( String value )
{
username = value;
}
public void setEmail( String value )
{
email = value;
}
public void setAge( int value )
{
age = value;
}
public String getUsername() { return username; }
public String getEmail() { return email; }
public int getAge() { return age; }
}
SaveName.jsp
<jsp:useBean id="user" class="UserData" scope="session"/>
<jsp:setProperty name="user" property="*"/>
<HTML>
<BODY>
<A HREF="NextPage.jsp">Continue</A>
</BODY>
</HTML>
NextPage.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>
Now when I submit the form , I get the following error.
Error 500
Internal Servlet Error:
org.apache.jasper.JasperException: Unable to compile class for JSPC:
\Tomcat\work\localhost_8080\_0002fjsp_0002fSaveName_0002ejspSaveName_jsp_0.java:67:
Class jsp.UserData not found.
UserData user = null;
^
C:
\Tomcat\work\localhost_8080\_0002fjsp_0002fSaveName_0002ejspSaveName_jsp_0.java:70:
Class jsp.UserData not found.
user= (UserData)
^
C:
\Tomcat\work\localhost_8080\_0002fjsp_0002fSaveName_0002ejspSaveName_jsp_0.java:75:
Class jsp.UserData not found.
user = (UserData)
Beans.instantiate(this.getClass().getClassLoader(), "UserData");
^
Can anyone help.