Hi All,
My question is in regard to submitting a JSP form that contains form 
fields displayed by iterating over a hashmap. 
I have defined a DynaActionForm in my Struts-config file in which, besides 
numerous String properties, I have one hashmap.

<form-bean
        name="profileform"
        dynamic="true"
        type="org.apache.struts.action.DynaActionForm">
        <form-property
                name="...."
                type="java.util.String" />
        <form-property
                name="userFields"
                type="java.util.HashMap" />
</form-bean>

Using the "profileForm.set()" method in my ShowAction for displaying the 
fields in my JSP form is working fine, including for the hashmap:

ShowAction code Fragment:

        HashMap userFields = new HashMap();
        [...builds a dynamic set of user field names and field values...]

        profileForm.set("userFields", userFields);

JSP code fragment:

<logic:iterate id="userField" name="profileform" property="userFields">
  <tr>
    <th align="left">
      <bean:write name="userField" property="key"/>
    </th>
    <td align="left">
      <html:text name="userField" property="value"/>
    </td>
  </tr>
  </logic:iterate>

Whereas the theory behind handling the String form fields ("dynamic" 
setters and getters) seems very straightforward, I don't understand how 
the dynamic form handles the hashmap fields (if it is handling them at 
all?) on submit. How do I access the edited hashmap field values for 
updating my business objects within the SaveAction? 
Copying from the successful processing of the form String fields, I have 
tried in the SaveAction:

        HashMap userFields = (HashMap)profileForm.get("userFields");

but NullPointerExceptions thrown while trying to access 'userFields' lead 
me to believe that I am not getting my desired results. 

Any guidance would be greatly appreciated.

Thanks,
Susan



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

Reply via email to