相关疑难解决方法(0)

@ViewScoped在每个回发请求上调用@PostConstruct

这似乎不对.我正在清理我的代码,我只是注意到了这一点.每个ajax请求都会触发构造函数和@PostConstruct我的@ViewScopedbean.即使是简单的数据库分页也会触发它.

知道@ViewScoped@RequestScoped任何请求都要重建并且不应该重建.只有在通过GET重新加载完整页面之后.

jsf constructor postconstruct jsf-2 view-scope

28
推荐指数
1
解决办法
2万
查看次数

绑定杀死支持豆...我做错了什么?

我有以下页面:

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:p="http://primefaces.org/ui"
  xmlns:h="http://java.sun.com/jsf/html">

<body>

    <ui:composition template="./templates/fireLeftMenuTemplate.xhtml">

        <ui:define name="left">
            <h:form>
                <p:menu model="#{gradingBean.courseMenu}"/>
            </h:form>
        </ui:define>

        <ui:define name="content">
            <h:form>
                <p:accordionPanel binding="#{gradingBean.assignmentView}"/>         
            </h:form>
        </ui:define>

    </ui:composition>

</body>
Run Code Online (Sandbox Code Playgroud)

GradingBean:

@Named("gradingBean")
@ViewScoped
public class GradingBean {

@EJB
private AssignmentManager assignmentManager;

/*
 * The assignmentMenu, listing all assignments for each course currently
 * assisted by this grader
 */
private final DefaultMenuModel courseView = new DefaultMenuModel();
private final AccordionPanel assignmentView = new AccordionPanel();

public …
Run Code Online (Sandbox Code Playgroud)

jsf java-ee primefaces

1
推荐指数
1
解决办法
562
查看次数