Thursday, May 2, 2013

Can we change the url-pattern in web.xml ..?

Yes...  

we can change the url-pattern to whatever we wish to see in the browser. Generally we may observe in most of the tutorials/books the common url patterns ..  





where in the url pattern *.htm refers to any name with an extension .htm.

If you want to change it to some other extension like .do, .action ..etc you can do that.





Suppose if we have a requirement such that we don't need any extension at the end of my web application's url. Then you can simply use ' / ' or ' /* ' instead of  ' *. extension'.



How it will work:

When we run the applicationa and send a request to server like this 

http://ip address: port number/ Application Name/ requested resource

Then the server will check for the last part of the url , the request resource 
(/requested resource) and compares with the url pattern configured in web.xml . If it matches then request will be forwarded to the corresponding controller configuration by the DispatcherServlet.



2 comments:

  1. Is titanium expensive? - Tatiana Art
    3 answersTitanium makes for excellent mens titanium earrings art in the titanium white rocket league art department. titanium tubing This is probably a step too far, and it's just a little bit outdated. You might get more titanium anodizing information about man titanium bracelet it from the

    ReplyDelete