일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
- ibsheet
- JDOM
- GPS
- jQuery
- jsr 296
- appspresso
- 가우스
- MFC
- sencha touch
- PLSQL
- Android
- WebLogic
- iBATIS
- JSON
- rowspan
- PHP
- 전자정부프레임워크
- swingx
- tomcat
- Spring
- MySQL
- dock
- Eclipse
- Struts
- oracle
- Ajax
- Google Map
- 선택적조인
- phonegap
- node.js
- Today
- Total
Where The Streets Have No Name
multi row input form 본문
First define a Bean called StudentGrades:
Package example;
public StudentGrades {
private String name, biology, chemistry, physics, english, math;
public String getName () { return this.name; }
public String getBiology () { return this.biology; }
public String getChemisty () { return this.chemistry; }
public String getPhysics () { return this.physics; }
public String getEnglish () { return this.english; }
public String getMath () { return this.math; }
public void setName (String name) { this.name = name; }
public void setBiology (String grade) { this.biology = grade; }
public void setChemisty (String grade) { this.chemistry = grade; }
public void setPhysics (String grade) { this.physics = grade; }
public void setEnglish (String grade) { this.english = grade; }
public void setMath (String grade) { this.math = grade; }
}
In your struts-config.xml, define:
<form-bean name="studentGradeForm"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="grades" type="example.StudentGrades[]" size="50">
</form-bean>
Then, presuming that your Action populates the StudentGrades array with
the student names, in your JSP, you'd say:
<html:form action="/some/action">
<TABLE>
<TR>
<TD>Name</TD>
<TD>Biology</TD>
<TD>Chemistry</TD>
<TD>Physics</TD>
<TD>English</TD>
<TD>Math</TD>
</TR>
<logic:iterate id="student" name="studentGradeForm" property="grades" type="example.StudentGrades">
<logic:notEmpty name="student" property="name">
<TR>
<TD><bean:write name="student" property="name" indexed="true"/></TD>
<TD><html:text name="student" property="biology" indexed="true"/></TD>
<TD><html:text name="student" property="chimstry" indexed="true"/></TD>
<TD><html:text name="student" property="physics" indexed="true"/></TD>
<TD><html:text name="student" property="english" indexed="true"/></TD>
<TD><html:text name="student" property="math" indexed="true"/></TD>
</TR>
</logic:notEmpty>
</logic:iterate>
</TABLE>
http://www.oracle.com/technology/products/jdev/tips/mills/JSP_Multi_Row_Edits.html