Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Avoiding "there is no Action" errors

 
Kevin P Smith
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I

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.

Cheers
 
Mohana Rao Sv
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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>
</action>
 
debraj mallick
Ranch Hand
Posts: 188
Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Kev Bellion,
i do agree with Mohana Rao,
i generally follow this approach, for your help here is the documentation link.
http://struts.apache.org/2.2.3.1/docs/action-configuration.html#ActionConfiguration-ActionDefault
hope this would help you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic