相关疑难解决方法(0)

com.sun.faces.context.FacesContextImpl.assertNotReleased中的java.lang.IllegalStateException

如果我按下提交按钮,则会在服务器日志中抛出错误消息

login.xhtml

<h:form>
    <p:panel header="Login">  

        <p:messages id="msgs" showDetail="true"/>

        <h:panelGrid columns="2" columnClasses="column" cellpadding="5">

            <h:outputLabel for="user" value="Username" />
            <h:inputText id="user" value="#{login.username}" />

            <h:outputLabel for="pw" value="Passwort" />
            <h:inputSecret id="pw" redisplay="false" value="#{login.password}" />

        </h:panelGrid>
        <p:commandButton value="Anmelden" action="#{login.login}" type="submit" update="msgs" />
    </p:panel>
</h:form>
Run Code Online (Sandbox Code Playgroud)

Login.java

@ManagedBean
@ViewScoped
public class Login {

    private FacesContext fCtx;
    private String username;
    private String password;

    public Login() {
        fCtx = FacesContext.getCurrentInstance();
    }

        public String login(){
    //      HttpSession session = (HttpSession) fCtx.getExternalContext().getSession(true);
    //      String sessionId = session.getId();
            fCtx.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO,"Info: ", getUsername()+", …
Run Code Online (Sandbox Code Playgroud)

jsf jsf-2

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

标签 统计

jsf ×1

jsf-2 ×1