wood burning stoves*
The moose likes Struts and the fly likes [Ask] Handle Wrong Actions? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "[Ask] Handle Wrong Actions?" Error Code 404 (Http Not Found)" Watch "[Ask] Handle Wrong Actions?" Error Code 404 (Http Not Found)" New topic
Author

[Ask] Handle Wrong Actions?" Error Code 404 (Http Not Found)

Leonardo Carreira
Ranch Hand

Joined: Apr 07, 2009
Posts: 489

Hi Friends..

how to handle the action which not configured?
example i just configure action for :
http://localhost:8080/MyApplication/MyPackage/new.action
http://localhost:8080/MyApplication/MyPackage/add.action

now what i have to do to handle wrong action?..
example anybody try to go to URL : http://localhost:8080/MyApplication/MyPackage/xyz.action

i have configure the error code in web.xml like this one :


but its doesn't work..

Thank's alot



Sorry, perhaps my english language isn't too good.. Prepare for SCJP 6, Please God help me.. ☼
References : [Java.Boot] [JavaChamp] [JavaPrepare]
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

http://struts.apache.org/2.x/docs/unknown-handlers.html
Leonardo Carreira
Ranch Hand

Joined: Apr 07, 2009
Posts: 489

Thank's David ..

is it only used in Struts2 especially for 2.1++ version?..

if iam using Struts2 with version 2.0.12.. how to i configure it?..

i have made an error page which named error404.html.., i want to all of the UnknownAction will redirecting to error404.html..
and display it..

Thank's in advance David..
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Action default.

http://struts.apache.org/2.0.12/docs/action-configuration.html

It'd probably be worth your time to read through much of the documentation.
Leonardo Carreira
Ranch Hand

Joined: Apr 07, 2009
Posts: 489

Alright.. Thank's David for your reply.. :)

i have tried it before, and but we have to configure it in all packages..
and it will work if any action behind the "namespace" which we configured..

now how to handle UnknownError behind our "servlet context"?..
example i have configured package like this one :

and the application name is MyApplication..

when i go to the URL : http://localhost:8080/MyApplication/guest/someError.action (Wrong Action)
the error404.html can be displayed..

then.. i try to go to URL behind of servlet context which not of packages or actions..
example i go to URL : http://localhost:8080/MyApplication/test.action (Wrong Action)
and the error404.html can't be displayed.. :(

how to configure it?..

Thank's in advance David :) ...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: [Ask] Handle Wrong Actions?" Error Code 404 (Http Not Found)
 
Similar Threads
How to handle java.lang.NullPointerException in Struts2?..
Catching HTTP Error Responses
User Defined Error Page for 404
handle 404 error
How to hide action "extension" in URL? (Struts2)