Struts2 如何从s:复选框中获取值
我想使用s:checkbox从表中获取值 我使用struts2创建此应用程序Struts2 如何从s:复选框中获取值,struts2,Struts2,我想使用s:checkbox从表中获取值 我使用struts2创建此应用程序 我的代码如下: testAction.java public class test extends ActionSupport{ private String id; private List<String> colors; private String yourColor; public String getYourColor() { return you
我的代码如下: testAction.java
public class test extends ActionSupport{
private String id;
private List<String> colors;
private String yourColor;
public String getYourColor() {
return yourColor;
}
public void setYourColor(String yourColor) {
this.yourColor = yourColor;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public List<String> getColors() {
return colors;
}
public void setColors(List<String> colors) {
this.colors = colors;
}
private List<ColorBean> list ;
public List<ColorBean> getList() {
return list;
}
public String execute() {
return SUCCESS;
}
public String display() {
return NONE;
}
}
当我尝试做这样的事情时
<h2>
value : <s:property value="yourColor.id"/>
</h2>
价值:
我什么也没收到。。
如何处理此问题寻求调试帮助的问题(“为什么此代码不起作用?”)必须包括所需的行为、特定的问题或错误以及在问题本身中重现此问题所需的最短代码。没有明确问题陈述的问题对其他读者没有用处。请参阅:如何创建最小、完整且可验证的示例。提示:
fieldValue=“%{list}”
是罪魁祸首您所说的fieldValue是什么意思?寻求调试帮助的问题(“此代码为什么不工作?”)必须包括所需的行为,一个特定的问题或错误,以及在问题本身中重现它所需的最短代码。没有明确问题陈述的问题对其他读者没有用处。请参阅:如何创建一个最小、完整且可验证的示例。提示:fieldValue=“%{list}”
是罪魁祸首fieldValue是什么意思??
<s:form action="resultAction" namespace="/">
<table id="dataTables-example">
<thead>
<tr>
<th>sheck</th>
<th>IF</th>
<th>CINOURC</th>
<th>NOMOURC</th>
</tr>
</thead>
<tbody>
<s:iterator value="list">
<tr>
<td>
<s:checkbox name="yourColor"
fieldValue="%{list}" theme="simple" />
</td>
<td><s:property value="id" /></td>
<td><s:property value="cin" /></td>
<td><s:property value="name" /></td>
</tr>
</s:iterator>
</tbody>
</table>
<h2>
value : <s:property value="yourColor"/>
</h2>
[bean.RarBean@42a3fe79, bean.RarBean@2d2cfd76, bean.RarBean@54e8f278]
<h2>
value : <s:property value="yourColor.id"/>
</h2>