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

name for servlets

vinoth ar
Greenhorn

Joined: Jan 07, 2009
Posts: 21
why we need to have three names for the servlets.... url name, deployement name and file-path name... we can find the particular servlets using file name path right?

vinothraman

arvinoth@in.com


vino...
Omar Al Kababji
Ranch Hand

Joined: Jan 13, 2009
Posts: 357
I don't know if this what you mean or not


in the DD web.xml

<servlet>
<servlet-name>servlet1</servlet-name>
<servlet-class>mypackage.Servlet1</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>servlet1</servlet-name>
<url-pattern>/servlet1</url-pattern>
</servlet-mapping>


if your question is why we have to put a servlet-name which in this case is "servlet1" and then we have to specify the url-pattern too which is "/servlet1" if this is your question the answer is because may be the programmer of the web application don't want to show the exact hirearchy of his web application for security reasons, so he could be mapping his servlet1 to a different url-pattern for example "/registration/registere.do" at this point for the user of the web application it may seem that thehre is actually a directory named registration however this does not exist.

hope i helped you if not please tell me what you meant exactly.

(peace)


Omar Al Kababji - Electrical & Computer Engineer
[SCJP - 90% - Story] [SCWCD - 94% - Story] [SCBCD - 80% - Story] | My Blog
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

vinoth ar wrote:why we need to have three names for the servlets.... url name, deployement name and file-path name..


thats the beauty of servlet . security purpose

vinoth ar wrote: we can find the particular servlets using file name path right?


what mean by file name path? you mean url-pattern ?...... so what do you think about the way of accessing the servlet?
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
vinoth ar wrote:why we need to have three names for the servlets.... url name, deployement name and file-path name... we can find the particular servlets using file name path right?

vinothraman

arvinoth@in.com

The <servlet-class> roughly imports the servlet class.
The <servlet-name> roughly represents the instance name. E.g. Servlet1 servlet1 = new Servlet1().
The <url-pattern> defines the URL pattern which should invoke this servlet.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: name for servlets