Spring webflow 一个视图中有多个窗体。Spring-web-flow+;显示标签+;复选框
在我的应用程序中,我有一个表,使用display标记,即使用springwebflow。我希望每行都有一个复选框,一个允许我选择/使用全部选择的按钮和一个执行函数的按钮。单击按钮后,该操作将执行一些数据库操作,页面应呈现,以便我们可以看到这些更改 我不知道哪一个可能是最好的选择,提交整个表格Spring webflow 一个视图中有多个窗体。Spring-web-flow+;显示标签+;复选框,spring-webflow,displaytag,Spring Webflow,Displaytag,在我的应用程序中,我有一个表,使用display标记,即使用springwebflow。我希望每行都有一个复选框,一个允许我选择/使用全部选择的按钮和一个执行函数的按钮。单击按钮后,该操作将执行一些数据库操作,页面应呈现,以便我们可以看到这些更改 我不知道哪一个可能是最好的选择,提交整个表格 <form method="POST" (more params)> <display:table id="row"> .... </disp
<form method="POST" (more params)>
<display:table id="row">
....
</display:table>
</form>
page.jsp
form:form modelAttribute="formAggregation.model1" id="overviewForm">
...
/form:form>
...
form:form method="POST" modelAttribute="formAggregation.model2">
display:table id="row" name="displayTagValueList" requestURI="overview?_eventId=tableAction">
display:column title="">
form:checkbox path="conversationIds" value="${row.threadId}"/>
/display:column>
/display:table>
input type="submit" name="_eventId_oneFunction" value="Send>>"/>
/form:form>
<form:form method="POST" id="tableForm" modelAttribute="model1">
<display:table id="row">
<display:column title="">
<form:checkbox path="chosenIds" value="${row.id}"/>
</display:column>
<display:footer>
<div class="tableFooter" >
<input type="submit" name="_eventId_workIds" value="Send"/>
</div>
</display:footer>
</display:table>
</form:form>
FormAggregation.java
@Component("formAggregation")
public class FormAggregation {
private Model1 model1;
private Model2 model2;
//Getters and setters
我需要这个聚合器,因为我需要两个模型。我已经一个接一个地测试了它,它工作正常。你知道吗
谢谢 我找不到在视图状态下添加两个模型的解决方案。所以我做了一个变通办法,将我需要的字段添加到我正在使用的模型中,
com.project.Model1
。因此,结果是:
page.jsp
form:form modelAttribute="formAggregation.model1" id="overviewForm">
...
/form:form>
...
form:form method="POST" modelAttribute="formAggregation.model2">
display:table id="row" name="displayTagValueList" requestURI="overview?_eventId=tableAction">
display:column title="">
form:checkbox path="conversationIds" value="${row.threadId}"/>
/display:column>
/display:table>
input type="submit" name="_eventId_oneFunction" value="Send>>"/>
/form:form>
<form:form method="POST" id="tableForm" modelAttribute="model1">
<display:table id="row">
<display:column title="">
<form:checkbox path="chosenIds" value="${row.id}"/>
</display:column>
<display:footer>
<div class="tableFooter" >
<input type="submit" name="_eventId_workIds" value="Send"/>
</div>
</display:footer>
</display:table>
</form:form>
flow.xml
var name="model1" class="com.project.Model1"/>
var name="model2" class="com.project.Model2"/>
view-state id="overview" model="formAggregation">
...
</view-state>
<var name="model1" class="com.project.Model1"/>
...
<transition on="workIds" to="overview" validate="false">
<evaluate expression="actionBean.workIds(model1.chosenIds)" />
</transition>
...
java类
public void workIds(List<Long> ids) {
公共无效工作ID(列表ID){
希望有帮助我不知道为什么,我的第二段代码没有显示: