You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ed Abrams <Ed...@trellix.com> on 2000/04/18 18:52:22 UTC
JWS and Tomcat: A feature?
Hi,
In JWS, you can create a servlet mapping merely by linking an arbitrary name
to a class, somewhere in JWS's classpath, that implements the Servlet
interface.
In Tomcat, I can see that you can add a servlet class to the ROOT webapp's
classes directory, and you can come fairly close to mimicing the JWS
functionality that way. However, I can't see how to create a mapping from
an arbitarary servlet name, e.g.
myServletOne
to a class in a .jar file. I tried putting a .jar file in the jakarta/lib
directory and referencing the class in there directly, i.e. (conf/web.xml):
<I also tried this with the .jar in webapps/ROOT/WEB-INF/classes directory>
<servlet>
<servlet-name>myServletOne</servlet-name>
<servlet-class>com.test.testOne</servlet-class>
</servlet>
But to no avail. There are just some situations where I don't want to go
through the process of creating a .war file to get what I want out of
tomcat. It would seem silly that tomcat could not create a mapping between
an arbitrary name and any class within its CLASSPATH. Any help would be
appreciated.
Eddie
EdA@trellix.com
post method on tomcat
Posted by Peter Choe <ch...@mindspring.com>.
i am trying to write a logon jsp. but for some reason, when i try to use post
it doesn't send the information to the next jsp. but if i use get, it works.
i am using tomcat3.0 for the jsp engine. anyone know if there is a problem with
tomcat and using the post method? or do i have to configure something to allow
post?
peter choe
Re: JWS and Tomcat: A feature?
Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Ed Abrams wrote:
> Hi,
>
> In JWS, you can create a servlet mapping merely by linking an arbitrary name
> to a class, somewhere in JWS's classpath, that implements the Servlet
> interface.
>
> In Tomcat, I can see that you can add a servlet class to the ROOT webapp's
> classes directory, and you can come fairly close to mimicing the JWS
> functionality that way. However, I can't see how to create a mapping from
> an arbitarary servlet name, e.g.
>
> myServletOne
>
> to a class in a .jar file. I tried putting a .jar file in the jakarta/lib
> directory and referencing the class in there directly, i.e. (conf/web.xml):
> <I also tried this with the .jar in webapps/ROOT/WEB-INF/classes directory>
>
> <servlet>
> <servlet-name>myServletOne</servlet-name>
> <servlet-class>com.test.testOne</servlet-class>
> </servlet>
>
You've got half of the problem solved. At this point, you can do a request like
this:
http://myserver/servlet/myServletOne
and have your servlet invoked. If you want to map the servlet to some other
path, you also need to create a <servlet-mapping> entry for it -- for example,
to attach your servlet to the URL "/test", you would say:
<servlet-mapping>
<servlet-name>myServletOne</servlet-name>
<url-pattern>/test</url-pattern>
</servlet-mapping>
>
> But to no avail. There are just some situations where I don't want to go
> through the process of creating a .war file to get what I want out of
> tomcat. It would seem silly that tomcat could not create a mapping between
> an arbitrary name and any class within its CLASSPATH. Any help would be
> appreciated.
>
Where Tomcat finds classes (servlets and non-servlets are alike in this respect)
is completely independent of the paths you use to request them. The standard
places to put your own classes are
* Unpacked under the "WEB-INF/classes" directory
of your web application
* JAR files under the "WEB-INF/lib" directory of your
web application.
These two things are automatically added to the class path for that application,
so you don't need to mess with the CLASSPATH environment variable at all.
Note -- Tomcat 3.0 and early versions of 3.1 had problems reading classes from
JAR files under WEB-INF/lib -- be sure to use the most recent 3.1 release
candidate (or the final release) for this.
>
> Eddie
> EdA@trellix.com
>
Craig McClanahan