tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Naban...@ccbc.ca
Subject Internal Servlet Error
Date Sat, 07 Apr 2001 16:45:18 GMT

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.




Mime
View raw message