Google

Saturday, April 28, 2007

Handeling "page not found" using Struts

While surfing web, Most of us have encountered 404- Page not found message. Any resource you request; If it does not exist on server you would get such an error. In struts applications when you request for x.do and if there is no Action-mapping defined in struts-config.xml file for ActionForward x; You would get such an error.

Unknown ActionMapping
In struts you can define one ActionMapping which will receive all requests for which no ActionMappins is defined. It is called "Unknown ActionMapping".
<action
name="/debug"
unknown="true"
forward="/pages/debug.jsp/>

Notably one can also do some NLP or spell correction to seek for resource user might be looking for and can ask to give that resource. This helps improving user experience while surfing your site.

Labels: , , ,

2 Comments:

Blogger Schu said...

Just so no one is confused, the example given for the unknown mapping should have a "path" attribute, not a "name" attribute.

June 6, 2007 at 7:28 AM  
Blogger Software Wikipedia said...

Hi, Would you be interested to exchange link with my blog at http://software-wikipedia.blogspot.com.
mail me at software.wikipedia@gmail.com if you are interested.

October 3, 2008 at 2:44 PM  

Post a Comment

Subscribe to Post Comments [Atom]

<< Home