0

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.

Cœur
  • 37,241
  • 25
  • 195
  • 267
pavul
  • 27
  • 2

1 Answers1

0

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.

prem30488
  • 2,828
  • 2
  • 25
  • 57
  • thanks, but option one is not working, i dont know why, the problem was solved with tag – pavul Jul 08 '14 at 15:52
  • yes. you are right. But what I suggested is for both actions and jsp pagenames in url. If someone put jsp name in url than we can make a custom error page. In your case sounds good for actions. – prem30488 Jul 08 '14 at 16:12