[prev in list] [next in list] [prev in thread] [next in thread] 

List:       struts-dev
Subject:    DO NOT REPLY [Bug 16564] New:  -
From:       bugzilla () apache ! org
Date:       2003-01-29 21:47:28
[Download RAW message or body]

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=16564>.
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=16564

ActionForm not populating String[] correctly

           Summary: ActionForm not populating String[] correctly
           Product: Struts
           Version: 1.1 Beta 3
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Standard Actions
        AssignedTo: struts-dev@jakarta.apache.org
        ReportedBy: rkischuk@gttx.org


I am using multiboxes to output the following form fragment:

   <table>
        <tr>
         <td><input type="checkbox" name="selectedModules" value="3">
		</td>
         <td><a
href="/totality/totality-admin/module/viewModule.do?moduleId=3">Site
Administration</a></td>

        </tr>
        <tr>
         <td><input type="checkbox" name="selectedModules" value="2">
		</td>
         <td><a
href="/totality/totality-admin/module/viewModule.do?moduleId=2">Root
Administration</a></td>
        </tr>
        <tr>
         <td><input type="checkbox" name="selectedModules" value="1">

		</td>
         <td><a
href="/totality/totality-admin/module/viewModule.do?moduleId=1">Global</a></td>
        </tr>
        <tr>
         <td><input type="checkbox" name="selectedModules" value="4">
		</td>
         <td><a
href="/totality/totality-admin/module/viewModule.do?moduleId=4">USUQ</a></td>
        </tr>
   </table>

When I submit this form to my ActionForm, which has the following variables with
corresponding getters and setters:
    private String id;
    private String name;
    private String description;
    private String[] selectedModules = new String[0];

and method definition:
	public void reset(ActionMapping arg0, HttpServletRequest arg1) {
		selectedModules = new String[0];
	}

defined in my struts-config as:

    <action    path="/org/org"
              
type="com.tailoredtechnologies.totality.modules.rootadmin.action.OrgDispatchAction"
               name="updateOrgForm"
               parameter="method"
               scope="request"
               validate="false">
      <forward name="success" path="/org/index.do"/>
      <forward name="successEdit" path="/org/editOrg.jsp"/>
      <forward name="successList" path="/org/index.jsp"/>
      <forward name="successLoad" path="/org/viewOrg.jsp"/>
    </action>

The array is not properly populated.  The array always contains all of the
values I have checked except for the first one.  Inspection of the request
parameters reveals that whichever checkbox is first has its value kept in a
request parameter.

To clarify, the result of submitting the above form is that there is that
form.getSelectedModules() yields a String[] with values { 2, 1, 4 }, and in my
struts action (a DispatchAction), if I call
request.getParameter("selectedModules"), it yields the String "3", the exact
value that is missing from my array.  This is true regardless of how many boxes
are checked.

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic