Thanks Tyson Cung and Thai Son Cung (Are you same person?).. I already
figured it out..
My two Objective in this issue:
1. Catch all mapping that do not exist in struts.xml
Solution: Put wildcard in the action name
Example:
<action name="*">
<result name="success">openRate.html</result>
</action>
2. Catch all exception in mapping which slips in my Action level (ex.
readDataAction not action mapping)
Solution: I found two ways in accomplishing it. One, is by using
<global-exception-mappings>
Second is declaring <exception-mapping
exception="com.acme.CustomException" result="custom_error"/>
in your Action Mapping.
I took advantage of <global-exception-mappings> coz i
need to apply one redirect page to all catch exception.
Here is the code:
<global-exception-mappings>
<exception-mapping
exception="java.lang.Exception" result="custom_error"/>
</global-exception-mappings>
<action name="editUser" class="userAction" method="edit">
<interceptor-ref name="exception"/>
<interceptor-ref name="basicStack"/>
<result name="custom_error"
type="redirect">openRate.html</result>
<result
name="success">/WEB-INF/pages/userForm.jsp</result>
<result
name="input">/WEB-INF/pages/admin/userList.jsp</result>
</action>
There you have it.. Hope its people in the future with same
issue.
Cheers,
Nelson Biasura
Nelson Biasura wrote:
I tried your suggestion Thai Son Cung. It works. But i'm looking for
more decent solution.
I am wondering if the namespace in xwork might be the solution., it
think this feature is available is struts too.
I have done some experiment regarding it but no success so far. Here
is the link:
http://www.opensymphony.com/xwork/wikidocs/Configuration.html#Configuration-Namespace
It says "The default namespace, which is "" (an empty string) is used
as a "CATCH-ALL" namespace, so if an action configuration is not found
in a specified namespace, the default namespace will also be searched.
This allows you to have global action configurations outside of the
"extends" hierarchy, as well as to allow the previous Webwork 1.x
behavior by not specifying namespaces. It is also intended that the
namespace functionality can be used for security"
Anyone who could clarify or used it before? or example of this would
be great.
Thanks Guys,
Nelson
Thai Son Cung wrote:
Hi Nelson,
I am not sure if it is the correct way of doing the direction.
You can create an jsp says openRate.jsp at the root level (together
with 403.jsp etc.) which contains:
<%@ include file="/common/taglibs.jsp"%>
<c:redirect url="/openRate.html"/>
and change /403.jsp to /openRate.jsp
Best Regards,
Tyson Cung
Hello Technology Pte. Ltd.
180 Cecil Street, #07-03, Bangkok Bank Building, Singapore 069546
(F : +65 6534 7133 (HP : +65 93896675
* tyson.c...@hello-technology.com
On 18 Nov 2009, at 21:10, Nelson Biasura wrote:
Thanks Tyson, yes that is what i'm doing right now. But the problem
is that when i changed (for example) 403.jsp into openRate.html
which is
available in my struts.xml mapping. the result is blank page! i
can't do direct calling of the jsp like /pages/openRate.jsp because
it must go through my
action for regular processing for data collection. Any syntax
suggestion mate?
Tyson Cung wrote:
Hi Nelson
Check the web.xml for error-page tag and change the location page
accordingly. For example:
<error-page>
<error-code>500</error-code>
<location>/error.jsp</location>
</error-page>
<error-page>
<error-code>400</error-code>
<location>/index.jsp</location>
</error-page>
<error-page>
<error-code>403</error-code>
<location>/403.jsp</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/index.jsp</location>
</error-page>
Regards
Tyson
On Wed, Nov 18, 2009 at 5:14 PM, Nelson Biasura
<nelson.bias...@aurisoftsys.com
<mailto:nelson.bias...@aurisoftsys.com>> wrote:
Hello guys, I want to redirect users if in case there are errors
encountered or if the URL
they entered in not available in struts.xml mapping. How can i
configure it appfuse?
Thanks,
Nelson
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
<mailto:users-unsubscr...@appfuse.dev.java.net>
For additional commands, e-mail: users-h...@appfuse.dev.java.net
<mailto:users-h...@appfuse.dev.java.net>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net