struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "amol (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (WW-4913) 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
Date Thu, 01 Feb 2018 11:50:00 GMT

     [ https://issues.apache.org/jira/browse/WW-4913?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

amol updated WW-4913:
---------------------
    Attachment: Source.txt

> 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.15
>
>         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)

Mime
View raw message