This week's giveaway is in the Programmer Certification (OCPJP) forum.
We're giving away four copies of Java Mock Exams (software) and have David Mayer on-line!
See this thread for details.
Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

url-mapping in Struts

 
Vrushali Gore
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all

Can anyone help me in knowing what exectly we do when we specify url-pattern as *.do? What that do indiactes? Does it mean that struts framework gives .do extension by default to every page?

Thanks in advance.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you look in your web.xml file, you will find an entry similar to the following:

This is essentially telling the server: "If you get a request URL that ends in .do, pass it to the Struts ActionServlet class for processing".
Once inside ActionServlet, the code knows that if the URL is /myAction.do, it is to instantiate and call execute on the class you've defined for the "/myAction" mapping.

Going the other direction, if you specify "/myAction" as the action in an html:form tag, the tag logic will append ".do" to the action when it is composing the actual URL that gets sent to the server when the form it submitted.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!