I'm just getting started with my JSP and tomcat experience, and while 
learning how JSP works, I'm can't get tomcat to recognize supporting
class definitions that I have placed in <myapp>/WEB-INF/classes.

Here's my setup:
* tomcat 5.0.19, running on RedHat Linux 9.0 Pro
* no customization to $CATALINA_HOME/conf/web.xml
  no customization to $CATALINA_HOME/conf/server.xml
  added my user account as a manager in $CATALINA_HOME/conf/tomcat-users.xml
* I'm running tomcat using the $CATALINA_HOME/bin/startup.sh
* I'm running tomcat as my normal login id, although I've also tried it as
  root just to make sure it wasn't a file permissions issue.
* I'm able to use the Tomcat manager at http://localhost:8080/manager to
  start/stop/reload/deploy applications
* The jsp-examples appear to work fine

Here's what I'm trying to do:
* Created the following "index.jsp" and placed it in
  $CATALINA_HOME/webapps/test
    
    <html><body>
    <form method=post action ="savename.jsp">
        What's your name?  <input type=text name=username size=20>
        What's your email? <input type=text name=email size=20>
        <P><input type=submit>
    </form></body></html>

* Created the following as $CATALINA_HOME/webapps/test/savename.jsp
    <jsp:useBean id="user" class="UserData" scope="session"/>
    <jsp:setProperty name="user" property="*"/>
    <html><body>
        Name: <%= user.getUsername() %><BR>
        Email: <%= user.getEmail() %><BR>
    </body></html>

* Created a UserData.java file that defines a public class UserData
  with username and email fields as type String. Added public
  access methods for setUsername, getUsername, setEmail, getEmail.
  I compiled UserData.java using javac, and to produce UserData.class
  which I placed in $CATALINA_HOME/webapps/test/WEB-INF/classes. The
  UserData.java class does not define a package nor does it import
  anything (line 1 is "public class UserData")

* deployed the "test" application using the tomcat manager and it shows
  that the application is deployed with no errors.

* Using IE 6.0, I enter the url to test.jsp and it displays the form as
  expected. I enter a name and email value into the form and press the
  submit button and I get the following:
     HTTP Status 500 -
     exception
     org.apache.jasper.JasperException: Unable to compile class for JSP
     An error occurred at line: 1 in jsp file: /savename.jsp

     Generated sevlet error:
        [javac] Compiling 1 source file
        <...>/work/Catalina/localhost/test/org/apache/jsp/savename_jsp.java:42
        symbol : class UserData
        location: class org.apache.jsp.savename_jsp
            UserDAta user = null


I suspect this is a classpath issue but everything I read says that if you
put your classes in <appdir>/WEB-INF/classes, it will just work. 

There must be some basic thing I'm missing. Any help would be very much
apprciated.

Thanks in advance.
-Andy.

-- 
###############################
# Andy Wadsworth              #
#                             #
# BondMart Technologies, Inc. #
# [EMAIL PROTECTED]          #
#                             #
###############################
    
    
    


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to