Primefaces数据表和视图范围
我在wildfly 8.2.0(mojarra 2.2.8)上使用primefaces 5.0 我尝试使用一个简单的primefaces数据表进行扩展,但每次我扩展一行时,我的备份beanPrimefaces数据表和视图范围,primefaces,jsf-2.2,view-scope,Primefaces,Jsf 2.2,View Scope,我在wildfly 8.2.0(mojarra 2.2.8)上使用primefaces 5.0 我尝试使用一个简单的primefaces数据表进行扩展,但每次我扩展一行时,我的备份bean@PostConstruct都会被触发(这会重新加载数据,首先会取消@ViewScoped的使用) 我在stackoverflow上看到了关于此问题的其他问题,但没有解决方案对我有效: 我正在使用JSF2.2+ 我没有使用任何JSTL标记 我在web.xml中禁用了部分状态保存 我尝试使用不同的@ViewSc
@PostConstruct
都会被触发(这会重新加载数据,首先会取消@ViewScoped
的使用)
我在stackoverflow上看到了关于此问题的其他问题,但没有解决方案对我有效:
- 我正在使用JSF2.2+
- 我没有使用任何JSTL标记
- 我在web.xml中禁用了部分状态保存
- 我尝试使用不同的
(bean、view甚至omnifaces'one)@ViewScoped
@Named
@javax.faces.view.ViewScoped
@SuppressWarnings("serial")
public class TestBean implements Serializable {
private List<String> things;
@PostConstruct
public void initialize() {
System.out.println("initializing...");
this.things = Arrays.asList("michael", "david", "paul");
}
public List<String> getThings() {
return this.things;
}
}
@Named
@javax.faces.view.ViewScoped
@抑制警告(“串行”)
公共类TestBean实现了可序列化{
私人物品清单;
@施工后
公共无效初始化(){
System.out.println(“初始化…”);
this.things=Arrays.asList(“迈克尔”、“大卫”、“保罗”);
}
公共列表getThings(){
归还这个东西;
}
}
我的模板:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>Test</title>
</h:head>
<h:body>
<p:dataTable value="#{testBean.things}" var="thing">
<p:column>
<p:rowToggler />
</p:column>
<p:column>
<h:outputText value="#{thing}" />
</p:column>
<p:rowExpansion>
<h:outputText value="#{thing}" />
</p:rowExpansion>
</p:dataTable>
</h:body>
</html>
试验
要工作,
必须位于
尝试使用@ManagedBean
替代?我尝试将@ManagedBean
与每个@ViewScoped
组合使用,但没有组合解决问题