【发布时间】:2014-02-19 05:04:37
【问题描述】:
我在使用 Primefaces dataTable 时遇到了一个问题,即 jsf 将调用我的托管 bean init(),它将从数据库中进行搜索。
在我的 jsf 中,用户可以执行另一个搜索,该搜索在字符串中传递一个参数。
<p:commandButton id="btnChild" type="Submit" icon="ui-icon-plus" styleClass="action-buttons" value="Child" update=":frmSysMenu:messages dtSysMenu" ajax="false" action="#{Controller.doParent('C')}" process="dtSysMenu" />
我的托管 bean 能够执行 doParent(String) 并将再次返回搜索屏幕,但一旦我的屏幕加载,它将调用 init() 其中:
@PostConstruct
@Override
public void init(){
try {
doSearch(nodeValue,"root");
setParentNode(nodeValue);
} catch (Exception e) {
addErrorMessage(e.getMessage());
e.printStackTrace();
Messages.addGlobalError(e.getMessage());
LOG.error(e.toString(), e);
}
}
它会回到第一个查询。 有没有其他方法可以做?
RequestScoped 有帮助吗?
【问题讨论】:
-
欢迎来到 Stackoverflow!如果您已经解决了您的问题(恭喜),请将其作为答案发布。它可以帮助其他人快速确定您的问题已解决。
-
非常感谢!对不起,我是新手,感谢您的建议:D
标签: jsf-2 primefaces managed-bean