Hi, Randy,

Thanks a lot for your reply. I think you raised a very good question regarding
portable JSP development. Everytime when  I try to move the JSP codes from one
place to another, I spent so much time on just making them work again.

I'm very slow on this. So, is that possible for you to explain to me what
should be the right way to develop a set of portable JSP codes?

This is what I'm currently doing:

1. I make a directory under webapps, call it xml.
2. Under xml, I have the following directories:
    WEB-INF (with  classes, jsp, lib web.xml),
    images (contains all my images)
    search.jsp  ( the main JSP script used for searching and some other jsp
scripts)
    includes   ( contains all my includes files, including .txt file, .jsp file
which will be used in the main search.jsp and other jsp files)
    servlets
3. And I put all my class files and jar files under WEB-INF/classes and
WEB-INF/lib directories in the xml directory.

4. And I have a source directory in $HOME/local/src/ and put all my java source
files there.

I'm a beginner for JSP programming (and JAVA programming) and would like to
start the right way. Can you give me some suggestions on this?

Thanks a lot and really appreciate your help.

Ming




Randy Layman wrote:

>         I believe that this is one of the ambiguities of the JSP/Servlet
> spec.  You old version will only work on Tomcat 3.3, not TC 3.2 or the newer
> 4.0, and it will only work if the JSP file is in the root directory of your
> webapp.  The reason is how the .java files are generated.
>
>         Under Tomcat 3.3 the package is set to be the path within the web
> app.  The root directory is in the unnamed package and JSP files in an
> sample1 directory are in the sample1 package.  Since Java implicitly imports
> all classes in the same package, jcrypt, which is also in the unnamed
> package, is found under this scheme.
>
>         Under other versions of Tomcat the package has other text preprended
> to the directory to make the package name (I believe one of them uses
> org.apache.jsp, but I'm not absolutely sure about that).  In this case only
> other JSP files in the same directory are implicitly imported and jcrypt
> isn't.
>
>         I don't believe that the spec specifies a requirement on this (I'm
> sure Craig will correct me if I'm wrong), which leads to the portable JSP
> developers rule - Import all classes needed!
>
>         Randy
>
> > -----Original Message-----
> > From: Ming [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, February 28, 2002 12:25 PM
> > To: Tomcat Users List
> > Subject: Re: JSP programming under Tomcat 4.0.2
> >
> >
> > Hi, Randy,
> >
> > Thanks a lot for your information.
> >
> > Here is my situation:
> >
> > My older tomcat is version 3.3 and new tomcat is version 4.0.2.
> >
> > This is the script in the older tomcat directory(very simple one):
> >
> > <%@ page language="java" contentType="text/html" %>
> > <%@ page info="Simple testing program" %>
> > <%@ page import="java.util.*" %>
> > <%@ page import="java.io.*" %>
> > <%@ page import="java.net.URL" %>
> >
> > <%@ include file="includes/js_include.txt" %>
> >
> > <html>
> > <head>
> >
> > <%  String inputString = "passwd";
> >     jcrypt jcrypt = new jcrypt();
> >     String cryptedPassword = jcrypt.crypt("MM", inputString);
> >
> > %>
> >
> > <title>Simple testing program</title>
> > </head>
> > <%= inputString %> and <%= cryptedPassword %>
> >
> > </html>
> >
> >
> > But under the new version of tomcat, this won't work until I
> > put a line <%@
> > page import="jcrypt" %>    at the beginning. I've put my
> > jcrypt.class file in
> > WEB-INF/classes and under $CATALINA_HOME/classes as well and
> > restart the
> > tomcat and apache. Still seems not working.
> >
> > I just read the documentation from jakarta site and you are
> > right, tomcat 3.3
> > and above version ignore the CLASSPATH variable. But my
> > question is, my older
> > version tomcat is 3.3 and new one is 4.0.2. Why does this
> > script work under
> > the older one and not the new one?
> >
> > Thanks a lot for your help.
> >
> > Ming
> >
> > Randy Layman wrote:
> >
> > >         All versions of Tomcat (and all JSP containers for
> > that matter)
> > > require you to add <%@ page import="...."%> to your JSP files.
> > >
> > >         Also, Tomcat versions 3.3 and beyond ignore your
> > system's classpath
> > > variable - it causes to may problems with people not
> > understanding how this
> > > interacted with the web apps.
> > >
> > >         Lastly, lots of people have experience using JSP
> > with Tomcat 4.02.
> > > If you have more specific questions please ask - this is
> > the right forum.
> > >
> > >         Randy
> > >
> > > > -----Original Message-----
> > > > From: Ming [mailto:[EMAIL PROTECTED]]
> > > > Sent: Wednesday, February 27, 2002 6:29 PM
> > > > To: Tomcat Users List
> > > > Subject: JSP programming under Tomcat 4.0.2
> > > >
> > > >
> > > > I'm using Tomcat 4.0..2 and apache 1.3.23. I move all my
> > > > class files to the
> > > > WEB-INF classes folder and jar files to the lib folder.
> > > >
> > > > I'm programming in JSP. But it seems that although all the
> > > > necessary class
> > > > files and jar files are in the classes and lib folder, I
> > > > still need to import
> > > > them in my JSP script. This wasn't the case before I upgraded
> > > > the tomcat and
> > > > apache.  Since the new tomcat is on the same machine as the
> > > > old one, the
> > > > classpaths are the same too.
> > > >
> > > > Does anybody have experience on programming JSP under Tomcat
> > > > 4.0.2? I really
> > > > appriciate if you can help.
> > > >
> > > > Thanks.
> > > >
> > > > Ming
> > > >
> > > >
> > > > --
> > > > To unsubscribe:
> > <mailto:[EMAIL PROTECTED]>
> > > > For additional commands:
> > <mailto:[EMAIL PROTECTED]>
> > > > Troubles with the list:
> > <mailto:[EMAIL PROTECTED]>
> > > >
> > >
> > > --
> > > To unsubscribe:
> > <mailto:[EMAIL PROTECTED]>
> > > For additional commands:
> > <mailto:[EMAIL PROTECTED]>
> > > Troubles with the list:
> > <mailto:[EMAIL PROTECTED]>
> >
>
> --
> To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to