struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Gainty <mgai...@hotmail.com>
Subject RE: Best practice for passing success/error message to another dispatch (struts2)?
Date Tue, 12 Aug 2008 19:19:41 GMT

your action execute method can return "error" result which maps to error page e.g.
<result name="error">/error.jsp</result>

where error looks like
<html>
<body>
<b>YOU have an error !</b>
</body>
</html>

better to create a div tag and write a meaningful error to response which displays response
in div tag ...
http://cwiki.apache.org/WW/ajax-recipes.html

Anyone else?
Martin 
______________________________________________ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business of Sender.
This transmission is of a confidential nature and Sender does not endorse distribution to
any party other than intended recipient. Sender does not necessarily endorse content contained
within this transmission. 


> From: jconner@uplogix.com
> To: user@struts.apache.org
> Date: Tue, 12 Aug 2008 15:05:42 -0400
> Subject: Best practice for passing success/error message to another dispatch (struts2)?
> 
> I have an action with two dispatch methods.
> I have a single JSP that renders a list and also have an import file field.
> On import failure, I want to populate the list with an error message.
> 
> THE PROBLEM:
> It looks like validation for the list() method is wiping the errors from the import()
method.
> 
> Example struts.xml:
>     <action name="*Role" class="RoleAction" method="list">
>       <result name="input">/list.page</result>
>       <result name="success">/list.page</result>
>     </action>
> 
>     <action name="importRole" class="RoleAction" method="import">
>       <result name="input" type="chain">listRole</result>
>       <result name="success" type="chain">listRole</result>
>     </action>
> 
> Example pseudo code:
> public String list() {
>   // sql lookup, populate list
>   return "success";
> }
> 
> public String import() {
>   // do import
>   If (fail) {
>     addActionError(errorMessage);
>   }
>   return "success";
> }
> 
> 
> 

_________________________________________________________________
Got Game? Win Prizes in the Windows Live Hotmail Mobile Summer Games Trivia Contest
http://www.gowindowslive.com/summergames?ocid=TXT_TAGHM
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message