Forums Register Login

name for servlets

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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)
+Pie Number of slices to send: Send
 

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?
+Pie Number of slices to send: Send
 

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.
Nothing up my sleeve ... and ... presto! A tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 920 times.
Similar Threads
FileInputStream creating a new File ??
Files : Path,Canonical Path,Absolute path ?
default path of Weblogic 7.0
Mapping jsp files
ActionClass.execute
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 06:16:56.