• Post Reply Bookmark Topic Watch Topic
  • New Topic

How To Customize Servlet URL To Point A Servlet Class

 
Nikhil Lanjewar
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have been pointing specific servlet requests to my Controller classes in Spring by using the <bean> tag. I did it by adding a mapping each for specific URL patterns so that the control reaches to their respective Controller classes. I used the DTD from http://www.springframework.org/dtd/spring-beans.dtd that enabled me to employ the <bean> tag.

Now, for some reasons, I'm not interested in using Spring. I would like to use a simple Java Servlet instead. For example, I would like to point http://localhost:8080/MyServlet/classA/entity1 to be handled at some Servlet class 'A'. Here, my servlet context will be /MyServlet and the rest shall be variable depending upon the type of requests. Is there any way to map specific URLs to my Servlet class? Any mappings to be made in my web.xml or similar tweaks?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exactly. Use the standard servlet mapping provided in the deployment descriptor.






 
sree_prasad
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Ankit Garg
Sheriff
Posts: 9591
34
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think your code is a bit wrong. It must be like this

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!