struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Conner <jcon...@uplogix.com>
Subject Best practice for passing success/error message to another dispatch (struts2)?
Date Tue, 12 Aug 2008 19:05:42 GMT
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";
}




Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message