• Post Reply Bookmark Topic Watch Topic
  • New Topic

Servelt url should not be displayed.

 
Sandhya Deekonda
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I've a web application which consists of one jsp file and one servlet.When i request for the servlet or jsp, the servlet url or jsp name shouldn.t be displayed.It should display like http://localhost:8080/AppName/xyz.How can i do that?? Can anyone tell me??
Thanks,
Sandhya.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can create any url-patterns you want in your servlet-mapping entries.

If there is only one, you could also create a mapping that matches your welcome-file entry.
 
Sandhya Deekonda
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ben,
Can you provide me a link or something which explains that?
Thanks,
Sandhya.
 
ashok ganesan
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it is simple add this code in the web.xml file . note here you should be using Tomcat as your server

<servlet-name>
the-name-that-u-wish-to-give
</servlet-name>
<servlet-class>
the-actual-classname-of-your-servletcode
</servlet-class>

so instead of accesing like http://10.152.49.240:8080/servlet/the-actual-classname-of-your-servletcode

you can do it by http://10.152.49.240:8080/servlet/the-name-that-u-wish-to-give
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The best resource is the servlet spec.
There is a link in my signature.
 
Sandhya Deekonda
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ben and Ashok,
I got it.
Thanks,
Sandhya.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!