You didn't attach the action source code, but I guess you are not
instantiating the Map before the ParameterInterceptor is executed. I
can think of 3 choices to do that:
1) instantiate the Map in the same place you declare the instance variable:
Map<String, List<Object> textMap = new HashMap<String, List<Object>();
2) instantiate the Map inside a prepare method (the action must
implement Preparable interface)
public void prepare() {
textMap = new HashMap<String, List<Object>();
}
3) get the (not null) instance from another place inside in the Map
getter & setter, for example, from session scope:
public Map<String, List<Object> getTextMap() {
return (Map<String, List<Object>) sessionMap.get("themap");
}
HTH
2010/1/7 satyanarayana katta <[email protected]>:
> Hi,
>
> Struts Version - 2.1.7
>
> We have an issue with the Map<String, List<Object>>. Here is the
> scenario, we are displaying the data from the List on the UI as the
> text fields. When a user changes and submits the form, the form data
> has to be saved.
>
> We are able to display the data from the List onto the UI. When the
> form is submitted, the Map is coming back as null in the action class.
>
> <s:iterator value="textMap" status="iterStatus">
> <s:iterator value="value" status="iterStatus1">
> <s:textfield
> name="textMap['%{key}']['%{#iterStatus1.index}'].name"
> value="%{name}"/>
> </s:iterator>
> </s:iterator>
>
> I am also attaching the source code
>
> SampleAction.java
> Sample.java (Pojo representing the Object in the list)
> struts.xml
> struts
> sample.jsp.
>
> Please help.
>
> Rgds,
>
> Satya
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]