Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

name for servlets

 
vinoth ar
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Omar Al Kababji
Ranch Hand
Posts: 357
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic