see intermixed.
"Soefara Redzuan" <[EMAIL PROTECTED]> on 03/14/2002 12:26:08 AM
Please respond to "Tomcat Users List" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
cc:
Subject: a better way to deploy servlets on tomcat ?
Sorry for another question but is there an easier way to load servlets into
Tomcat than the following process which I'm using now.
First, I write my servlet .java file for example in
webapps/<myapp>/WEB-INF/classes/myservlet.java
Second, I compile it.
Third, I add the servlet and servlet mapping to
webapps/<myapp>/WEB-INF/web.xml
<web-app>
<servlet>
<servlet-name>testServlet</servlet-name>
<servlet-class>testServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>
testServlet
</servlet-name>
<url-pattern>
/testServlet
</url-pattern>
</servlet-mapping>
</web-app>
Finally, I restart Tomcat.
Do I really have to add each servlet and its servlet mapping to web.xml or
is there a way to have all servlets automatically detected and served by
Tomcat ?
You typically could live without the need to add a mapping for each servlet
that you write. But if you wish to do some advanced stuff such as loading
the servlet when Tomcat starts, or you need to access the servlet by
another name rather than say
http://<yourdomain>/<yourwebapp>/servlet/testServlet, or suppose your
servlet needs init parameters, then it's a good idea to create a web.xml
(deployment descriptor). There are other uses for a web.xml. Check the
servlet spec. See Deployment Descriptor section.
Plus is there anyway to avoid the restarting of Tomcat ?
The reloadable=true attribute serves the purpose of reloading the web
application whenever tomcat detects a change (although the documentation
doesn't recommend once you have deployed your applications). The manager
web app can be used also to restart/install/stop/etc. a particular web
application without restarting Tomcat. See
http://localhost:8080/tomcat-docs/config/context.html
Thank you again, Soefara
_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx
--
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]>