0
votes

I have a problem, i have implemented the in struts2, and its going well, but when i put in the browser, an action that does not exists, like

http:mysite/someurl/somefake.action

i have a screen, where you can read "Struts Problem Report

Struts has detected an unhandled exception:

Messages:
There is no Action mapped for namespace [/] and action name [Portaaasdasdl] associated with context path []. "

the question is:

how can i know when i have a no mapped action and redirect that to a jsp where i can tell that action is not valid, or redirect to a custom jsp with a mesage "PAGE NOT FOUND"

i can't solve, and im a little frustrated.

1

1 Answers

0
votes

Step 1: In web.xml

<error-page>
     <error-code>404</error-code>
     <location>/file_not_found_404.html</location>
</error-page>

Step 2: In Web Content Folder create file_not_found_404.html

<html>
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
      <title>Insert title here</title>
   </head>
   <body>
      PAGE NOT FOUND
   </body>
 </html>

Note : I have not checked but I think this will work only for Apache tomcate 6.