Jsf 在seam中过帐时,新值不与表单支持对象绑定
我有多个表单由ThingPageBean填充。这些表单中的每一个都使用一个函数提交,其中操作被设置为调用{thingPageBean.doAmazingThingoneStuff}。除了contactEmail和contactPhone之外,所有字段都是静态的,我想使用它们来代替,以便用户可以根据需要设置新值 问题是,新值没有绑定到ThingPageBean中doAmazingThingOneStuff oneStuff中接收的对象。旧的仍然存在 我做错了什么?我是否错过了一些关键的部分 我的豆豆:Jsf 在seam中过帐时,新值不与表单支持对象绑定,jsf,xhtml,seam,Jsf,Xhtml,Seam,我有多个表单由ThingPageBean填充。这些表单中的每一个都使用一个函数提交,其中操作被设置为调用{thingPageBean.doAmazingThingoneStuff}。除了contactEmail和contactPhone之外,所有字段都是静态的,我想使用它们来代替,以便用户可以根据需要设置新值 问题是,新值没有绑定到ThingPageBean中doAmazingThingOneStuff oneStuff中接收的对象。旧的仍然存在 我做错了什么?我是否错过了一些关键的部分 我的豆
@SuppressWarnings({"unchecked"})
@AutoCreate
@Name("thingPageBean")
@Scope(ScopeType.EVENT)
@Restrict("#{s:hasRole('admin')}")
public class ThingPageBean implements Serializable {
@In
StuffService stuffService;
@In
private StatusMessages statusMessages;
public String doAmazingThing(OneStuff oneStuff) {
return this.stuffService.doAmazingStuffToThing(oneStuff);
}
@Factory(value = "notHandledStuff")
public List<Stuff> notHandledStuff() {
return this.stuffService.searchNotHandledStuff();
}
}
我的xhtml文件:
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:s="http://jboss.com/products/seam/taglib"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:c="http://java.sun.com/jstl/core"
template="/layout/SiteTemplate.xhtml">
<ui:param name="robots" value="noindex"/>
<!-- hide blocks -->
<ui:param name="preContentHide" value="true"/>
<ui:define name="mainContent">
<c:set var="stuff" value="#{notHandledStuff}"/>
<s:div styleClass="section"
rendered="#{stuff == null or stuff.size==0}">
<h:outputText value="#{messages['stuff.no']}"/>
</s:div>
<s:div styleClass="section"
rendered="#{stuff != null and stuff.size>0}">
<br/>
<ui:repeat var="oneStuff" value="#{stuff}">
<h:form id="stuffForm">
<hr style="margin-top:8px;margin-bottom:4px;"/>
<table border="1">
<tr>
<td><b>Company name:</b></td>
<td width="780px"><h:outputText value="#{oneStuff.companyName}"/></td>
</tr>
<tr>
<td><b>street:</b></td>
<td><h:outputText value="#{oneStuff.street}"/></td>
<td/>
</tr>
<tr>
<td><b>zip:</b></td>
<td><h:outputText value="#{oneStuff.zip}"/></td>
<td/>
</tr>
<tr>
<td><b>city:</b></td>
<td><h:outputText value="#{oneStuff.city}"/></td>
<td/>
</tr>
<tr>
<td style="padding-top:10px"><b>contactPerson:</b></td>
<td><h:outputText value="#{oneStuff.contactPersonName}"/></td>
<td/>
</tr>
<tr>
<td><b>contactEmail:</b></td>
<td><h:inputText value="#{oneStuff.contactEmail}"/></td>
<td/>
</tr>
<tr>
<td><b>contactPhone:</b></td>
<td><h:inputText id="contactPhone" value="#{oneStuff.contactPhone}"/></td>
<td/>
</tr>
<h:commandButton id="submit" value="couple"
action="#{thingPageBean.doAmazingThing(oneStuff)}"/>
</td>
</tr>
</table>
</s:div>
</h:form>
</ui:repeat>
<hr style="margin-top:8px;margin-bottom:4px;"/>
</s:div>
<br/>
</div>
</ui:define>
</ui:composition>
多谢各位
Jakob我建议更改@scopetype.EVENT
事件请求上下文:跨越服务器请求,从还原视图到呈现响应
到页面范围:@scopetype.page
在呈现页面之前的调用应用程序阶段开始,持续到源自该页面的faces请求的任何调用应用程序阶段结束。非面请求不会传播页面范围
因为您确实需要这些数据来进行更长的对话,而不仅仅是引用事件,所以问题似乎在于多种形式。把标签移到标签外面,瞧,一切都正常