>>> Mandar Joshi <[EMAIL PROTECTED]> 22-Mar-01 1:45:05 AM >>>

>for example I register a servlet with name
>Servlet1 I want to send a paramter "xyz" to it
>I register a same servlet class with another name
>Servlet2 I want it to take paramter "abc".
>The purpose of the whole exercise is to initialize
>the servlet depending its registered name / url,
>so that I can have some computation based on
>that.

To do exactly what you want can't be achieved.

However, you can do this in your web.xml:

<servlet>
  <servlet-name>fred1</servlet-name>
  <servlet-class>com.Fred.FredServlet</servlet-class>
  <init-param>someparam</init-param>
  <init-value>xyz</init-value>
</servlet>

<servlet>
  <servlet-name>fred2</servlet-name>
  <servlet-class>com.Fred.FredServlet</servlet-class>
  <init-param>someparam</init-param>
  <init-value>abc</init-value>
</servlet>

<servlet-mapping>
  <servlet-name>fred1</servlet-name>
  <url-pattern>/firstfred/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
  <servlet-name>fred2</servlet-name>
  <url-pattern>/secondfred/*</url-pattern>
</servlet-mapping>


There will be two copies of the servlet in the container, they will
be completely different instances but some communication is possible
using static methods and variables.


Nic

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to