tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yang Xiao <yx...@ohpp.com>
Subject RE: Classpath problems with tomcat on Linux 9
Date Mon, 19 Apr 2004 20:44:52 GMT
Hi,
You need the <%@ page import="package" %> directive to tell it where to look
for it.
Yang

-----Original Message-----
From: Andy Wadsworth [mailto:andyw@bondmart.com] 
Sent: Monday, April 19, 2004 3:11 PM
To: Tomcat Users List
Subject: Re: Classpath problems with tomcat on Linux 9


Still no luck. I'm basically trying to do exactly the same thing
that the "jsp-examples/checkbox" is doing and I can't get Tomcat
to recognize my UserData.class file. I've tried placing my UserData.class
file in every location possible, and no luck. My next step will be
to downgrade to Tomcat 4 so I can at least try out the examples that
are described in the Tomcat Bible (the examples don't work with
Tomcat 5).

Should I expect Tomcat to find my UserData.class file if I put it
in webapps/<myapp>/WEB-INF/classes? Do I need to create a web.xml 
or should it find the class file without any web.xml customization?
If anyone has a very simple example that I could drop in to see if
it works, I'd appreciate it. I've already verified that the jsp-examples
all work, but there is a lot of stuff in the web.xml that I shouldn't
need for what I want to do, and finding what I need is probably where
my problems lie.

-Andy.


On Friday 16 April 2004 07:32 pm, Berry, Layton wrote:
> I'm guessing you need to put the UserData class in a package,
> and import it into your savename page.
>
> Quoting from JSP 2.0 spec, "As of JSP 2.0, it is illegal
> to refer to any classes from the unnamed (a.k.a. default) package."
>
> -Layton
>
> >-----Original Message-----
>
> From: Andy Wadsworth [mailto:andyw@bondmart.com]
>
> >Sent: Friday, April 16, 2004 2:26 PM
> >To: tomcat-user@jakarta.apache.org
> >Subject: Classpath problems with tomcat on Linux 9
> >
> >
> >
> >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. #
> ># andyw@bondmart.com          #
> >#                             #
> >###############################
> >
> >
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: tomcat-user-help@jakarta.apache.org

-- 
###############################
# Andy Wadsworth              #
#                             #
# BondMart Technologies, Inc. #
# andyw@bondmart.com          #
#                             #
###############################
    The average woman would rather have beauty
    than brains, because the average man can see
    better than he can think.
    
    


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message