aspose file tools*
The moose likes Servlets and the fly likes deployment descriptor question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "deployment descriptor question" Watch "deployment descriptor question" New topic
Author

deployment descriptor question

ty lee
Greenhorn

Joined: Dec 27, 2005
Posts: 5
Dear Sir:
1.how can i configure servlet in web.xml?
2.after configuration done,how can i trigger servlet in web browser?
Thanks.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16305
    
  21

When you have to ask questions this basic, it means you really need to get some fundamental training; buy some books, take classes or something. Otherwise you'll spend your life asking the simple questions and people will get tired of answering.

At least you are headed in the right direction, so I'll give a general description.

Web.xml is the file that describes a WAR, and to make a servlet invokable, it usually takes 3 things:

1. A URL-to-logical servlet mapping

2. A logical-servlet-to-java-class mapping

3. A Servlet configuration

It could have been made simpler, but this way is more flexible. If I map the URL pattern "/info" to a logical servlet name "info-servlet", then map the logical servlet name "info-servlet" to an actual servlet class such as "com.javaranch.saloon.InfoServlet", then an HTTP request for "http://myserver.com/info" would invoke the servlet.

Actually, the real URL might be more complicated, since the "/info" is added to a Servlet Context that defines the base URL. For our simple case, the base URL is "http://myserver.com", but in a complex multi-app server environment running Tomcat, the base URL might be something like "http://myserver.com:8080/webapps/app1", and you'd then invoke your servlet via the URL "http://myserver.com:8080/webapps/app1/info".

Setting up the context (including base URL) is different for each appserver, so Tomcat, WebSphere and JBoss all have their own setups. But the stuff in web.xml remains the same.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: deployment descriptor question