DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22847>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22847

LookupDispatchAction used with submit using indexed fails

           Summary: LookupDispatchAction used with submit using indexed
                    fails
           Product: Struts
           Version: 1.1 Final
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Custom Tags
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


I use LookupDispatchAction as I have many submit buttons on the page.
of course if I use the submit buttons with indexed their name will be rendered 
as name[index] and value will be the resource string, so the 
LookupDispatchAction.execute can't find the parameter and fails to execute the 
right action.

Example: 

   <action path="/test"
           type="org.example.MyAction"
           name="MyForm"
          scope="request"
          input="/test.jsp"
      parameter="action"/>


   <html:form action="/test">
     <logic:iterate name="MyForm" property="myColl" id="element" indexId="ix">
     <html:submit property="action" indexed="true">
      <bean:message key="button.delete"/>
    </html:submit>
    <html:submit property="action" indexed="true">
      <bean:message key="button.delete"/>
    </html:submit>
    </logic:iterate>
  </html:form>

  protected Map getKeyMethodMap() {
      Map map = new HashMap();
      map.put("button.add", "add");
      map.put("button.delete", "delete");
      return map;
  }

  public ActionForward add(ActionMapping mapping,
          ActionForm form,
          HttpServletRequest request,
          HttpServletResponse response)
          throws IOException, ServletException {
      // do add
      return mapping.findForward("success");
  }

  public ActionForward delete(ActionMapping mapping,
          ActionForm form,
          HttpServletRequest request,
          HttpServletResponse response)
          throws IOException, ServletException {
      // do delete
      return mapping.findForward("success");
  }

this case this is how it's rendered in the html source->
<input type="submit" name="action[0]" value="Delete">

so when I press the first element delete, LookupDispatchAction won't find the 
action parameter as it's called now action[index].

Suggestion, 
It's possible to see if the parameter name exist but called as indexed like
action = action[*] and the index could be saved as an extra paramter which can 
be accessed in the action.

All the best!

Istvano

ps: Struts is an excellent framework!!!!

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to