jQuery in Action, 3rd edition
The moose likes Struts and the fly likes Avoiding Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Avoiding "there is no Action" errors" Watch "Avoiding "there is no Action" errors" New topic

Avoiding "there is no Action" errors

Kevin P Smith
Ranch Hand

Joined: Feb 18, 2005
Posts: 362

I was just wondering, is there a standard configurable (or coding if in fact it can e done) way of avoiding the horrid Struts error

When your user enters a URL/Action that does not exist?

So they get reirected to a nice 404 error or something rather than the nasty "Oh my god the sites crashed" type error that a standard user wouldn't probably understand.

Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485


Whenever we hit url in the browser struts filter search's respective action using actionMapping to execute the action. So now user is modified the class name so it couldn't found any action to execute it such cases we can tell if no action is found execute default action. And do whatever you want to do in the default action as per your business requirements. or else you can modify the default error pages in server which is bad approach i feel.

<default-action-ref name="defaultAction" />

<action name="defaultAction" class="com.yourcompany.DefaultAction">
<result name="success">/underconstruction.jsp</result>

ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
debraj mallick
Ranch Hand

Joined: Mar 08, 2011
Posts: 188

hi Kev Bellion,
i do agree with Mohana Rao,
i generally follow this approach, for your help here is the documentation link.
hope this would help you.
I agree. Here's the link: http://aspose.com/file-tools
subject: Avoiding "there is no Action" errors
It's not a secret anymore!