Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

question

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67620
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67620
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic