Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » more then one servlet
more then one servlet [message #669770] Wed, 11 May 2011 09:09 Go to next message
Ivana Missing name is currently offline Ivana Missing name
Messages: 14
Registered: December 2010
Junior Member
Is it possible to define more than one servlet in one bundle?

in web.xml :

<servlet>
<servlet-name>servlet1</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet </servlet-class>
</servlet>

<servlet>
<servlet-name>servlet2</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet </servlet-class>
</servlet>

in WEB-INF: servlet1-servlet.xml and servlet2-servlet.xml

but what with Web-ContextPath?

Ivana

[Updated on: Wed, 11 May 2011 09:52]

Report message to a moderator

Re: more then one servlet [message #669819 is a reply to message #669770] Wed, 11 May 2011 12:15 Go to previous messageGo to next message
rshelley  is currently offline rshelley
Messages: 59
Registered: April 2010
Member
Like a regular web application, you can have multiple servlets, you just need mappings to each one:

  <servlet-mapping>
    <servlet-name>servletA</servlet-name>
    <url-pattern>/servletA/*</url-pattern>
  </servlet-mapping>

  <servlet-mapping>
    <servlet-name>servletB</servlet-name>
    <url-pattern>/servletB/*</url-pattern>
  </servlet-mapping>


Your web context is common to both:

/foobar/servletA/
/foobar/servletB/
Re: more then one servlet [message #670022 is a reply to message #669819] Thu, 12 May 2011 08:38 Go to previous message
Ivana Missing name is currently offline Ivana Missing name
Messages: 14
Registered: December 2010
Junior Member
I made mistake during entering path in browser (I forgot web context path to enter), everything works fine.

thank you for the answer,

Ivana
Previous Topic:Can't deploy simple WAR
Next Topic:Bundles in Virgo, Bundles in Eclipse RCP
Goto Forum:
  


Current Time: Sat Apr 19 05:54:21 EDT 2014

Powered by FUDForum. Page generated in 0.01659 seconds