• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Servlet Aliasing  RSS feed

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks,
What exactly is servlet aliasing...can anybody explain me in detail....
Thanx in advance for ur effort and time
Bye
Vinay
 
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wit servlet aliasing the web server maps a request for a particular resource to the servlet class you create. In the servlet 2.2 API this is accomplished in the web.xml file for a particular applications.
For example, the following maps a request for "saynumb.au" to the NumberSoundServ servlet - as qualified by the full package. It also creates an initialization parameter that will be passed to the servlet init method.
<servlet><servlet-name>saynumb.au</servlet-name> <servlet-class>com.JSPbook.Chap04.NumberSoundServ</servlet-class>
<init-param>
<param-name>basepath</param-name> <param-value>c:/tomcat/webapps/Root/JSPbook/Chap04/sounds
</param-value>
</init-param>
</servlet>
Bill

------------------
author of:
 
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kumar,
Servlet alias means you are calling a servlet with another name of your choice at the URL.
It is always good idea to keep the servlets inside packages and deploy. Assuming you have a LoginServlet kept like this.
com.company.dept.project.LoginServlet.
It need not have this much depth level. What I use is one level depth like MISApp.LoginServlet.
So when we make a request from a url we write like this.
Instead of calling the Servlet with its package name like above everytime, we may choose to have a simple name like this

This means we made an alias for MISApp.LoginServlet as just 'LoginServlet'. For this we have to edit web.xml file and add entries for LoginServlet as Bill stated above. If the servlet container supports Servlet 2.2 API web.xml is the place to write all aliases for servlets.
regds
maha anna
[This message has been edited by maha anna (edited December 09, 2000).]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!