Details
-
Task
-
Status: Closed
-
Major
-
Resolution: Not A Problem
-
None
-
None
-
None
Description
1> SampleAction.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"; } }
2> ValueHolderExt.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; } }
3> sample.jsp
<%@ 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>