Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

question

 
sandeep Talari
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<url-pattern> *.do</url-pattern> .

the url-pattern what we give, the client will request on the web browser. I'm little bit confused about *.do .what does it mean.
 
James Ellis
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should clarify your question, but I'll try and guess at what you're after.

Developers of servlets often name their servlets whatever they want. For instance you could have a servlet named GetWeatherServlet, that an end user could access via getWeather.do or weather.do or whatever you won't to call it. You would define these mappings in web.xml. Example:



You don't have to call it ".do" however, you could call it whatever you want as long as it matches the user's request.
 
Steve Luke
Bartender
Posts: 4181
21
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by sandeep Talari:
<url-pattern> *.do</url-pattern> .

the url-pattern what we give, the client will request on the web browser. I'm little bit confused about *.do .what does it mean.


And for that specific case, it means all requests for the given context that in the three characters ".do" will invoke this Servlet. So if you web app is located at:
http://my.domain.com/MyApp/
Then all of the following URLs will go to the servlet mapped to *.do:
http://my.domain.com/MyApp/weather.do
http://my.domain.com/MyApp/ornot.do
http://my.domain.com/MyApp/secret/secret.do
http://my.domain.com/MyApp/under/where/.do

But these won't:
http://my.domain.com/MyApp/GetWeather
http://my.domain.com/MyApp/.do/SomeThing (at least I don't think this will)
http://my.domain.com/MyApp/index.jsp
http://my.domain.com/MyApp/Some/Where/overTheRainbow.gif

The *.do is usually a mapping for a single Controller Servlet that uses parameters and the values before the ".do" signifier to determine what to do. It is a central concept to many MVC frameworks like JSF and Struts.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64698
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please be sure to take the time to compose descriptive subjects for your posts; read this for more information.

Using a title of "question" in a forum completely dedicated to answering questions isn't very helpful. What if everyone named their topics "question"?

You can go back and change your post to add a more meaningful subject by clicking the .
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64698
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The .do is a convention (rather clumsy, I think) of Struts 1 apps. As pointed out, URL mappings can take many forms. This is not a good one to follow should you not be using Struts 1.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic