aspose file tools
The moose likes Servlets and the fly likes question Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "question" Watch "question" New topic
Author

question

sandeep Talari
Ranch Hand

Joined: Dec 24, 2007
Posts: 63
<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

Joined: Oct 14, 2004
Posts: 205
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

Joined: Jan 28, 2003
Posts: 3041
    
    4

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.


Steve
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56229
    
  13

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 .


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56229
    
  13

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.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: question
 
Similar Threads
servlet-mapping
Help me with servlet - mapping
servlet deployment
url-pattern tag in web.xml
Doubt in a question