[ 
https://issues.apache.org/jira/browse/WW-4913?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16401612#comment-16401612
 ] 

Yasser Zamani commented on WW-4913:
-----------------------------------

Hello [~amolbd],

You have {{private Map<String, String> optionSelections}} in your action? So, 
also generate it's standard java getter method , getOptionSelections method.

What is {{quoteForm.}}? I guess it's not needed except when your action has a 
{{getQuoteForm}} method. If not, So  please remove it and try below instead. As 
you have check boxes, I also guess you may should have {{private Map<String, 
Boolean> optionSelections}}.

{code:xml}
<s:checkbox name="optionSelections['abc']" ></s:checkbox>
<s:checkbox name="optionSelections['def']" ></s:checkbox>
{code}



> when using an custom array as a filed in struts 2 action form textfiled data 
> from jsp page in not populating into custom array but populating in String 
> array or array list
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-4913
>                 URL: https://issues.apache.org/jira/browse/WW-4913
>             Project: Struts 2
>          Issue Type: Task
>            Reporter: amol
>            Priority: Major
>             Fix For: 2.5.16
>
>         Attachments: Source.txt
>
>
> 1> SampleAction.java
> {code:java}
> public class SampleAction{
>     private ValueHolderExt[] name = new ValueHolderExt[17];
>     private String[] age = new String[17]; 
>         public ValueHolderExt[] getName() {
>               return name;
>       }
>       public void setName(ValueHolderExt[] name) {
>               this.name = name;
>       }
>       public String[] getAge() {
>               return age;
>       }
>       public void setAge(String[] age) {
>               this.age = age;
>       } 
> public String execute() throws Exception { 
> return "success";
> }
> }
> {code}
> 2> ValueHolderExt.java
> {code:java}
> import java.io.Serializable;
> public class ValueHolderExt implements Serializable {
>     private static final long serialVersionUID = 7813961312803493438L;
>     private String data = "";
> public String getData() {
> return data;
> }
> public void setData(String data) {
> this.data = data;
> }   
> }
> {code}
> 3> sample.jsp
> {code:xml}
> <%@ include file="/WEB-INF/jsp/includes/include.jsp"%>
> <s:form onsubmit="return doFormSubmit();" method="post"
> action="/membersPersonalDetailsSubmit">
> <fieldset>
> <legend>
> <fmt:message key="membersPersonalDetails.title" />
> <fmt:message key="general.required.instruction" />
> </legend>
> <table id="zebra" border="0" cellspacing="0" width="100%">
> <thead>
> <tr>
> <th><s:text name="Name" /></th>
> <th>
> <!--  <display:fieldLabel styleClass="borderlesslabel" 
> key="membersPersonalDetails.field.gender" property="gender" 
> errors="gender|gendertitle" required="true"/> -->
> <s:text name="Age" />
> </th>
> </tr>
> </thead>
> <s:iterator begin="0" end="5" var="idx">
> <c:set var="zebraClass" value="odd" scope="page" />
> <c:if test="{idx % 2 eq 0}">
> <c:set var="zebraClass" value="even" scope="page" />
> </c:if>
> <tr class='<c:out value="${zebraClass}" />'>
> <td><c:out value='${idx+1}' /> <s:textfield
> name="name[%{#idx}].data" id="name[%{#idx}].data" size="15" /></td>
> <td><s:textfield name="age[%{#idx}]" id="age[%{#idx}]"
> size="15" /></td>
> </tr>
> </s:iterator>
> </table>
> </fieldset>
> <br />
> <br />
> <div id="navRight">
> <s:submit cssClass="button yellow buttonClick"
> key="membersPersonalDetails.button.continue.tooltip" value="continue" />
> </div>
> </div>
> </s:form>
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to