让目标无法访问,“用户”有时会返回null

时间:2014-06-12 17:29:49

标签: jsf-2 jsf-2.2 backing-beans

我有一个显示如下对话框的链接:

<h:form>
    <div class="btn-alt" id="#signupStart">
        <h:commandLink action="#{signUpBean.displaySignUpScreenAction()}">#{msg['action.createaccount']}
        <f:ajax onevent="function(data) {if (data.status == 'success') {$('#signUpDialog').dialog('open');startGA();} }"  render=":signupform"/>
        </h:commandLink>
    </div>
</h:form>

<h:form id="signupform" title="#{msg['action.createaccount']}"><input type="hidden" autofocus="autofocus" />

    <div style="position: relative;">                       
        <h:inputText maxlength="50" id="txtFirstName" placeholder="#{msg['firstname']}" value="#{signUpBean.user.firstName}" styleClass="#{component.valid?'':'field-error'}" title="#{msg['firstname']}">
            <f:ajax event="blur" render="txtFirstName messages"/>                       
        </h:inputText>
    </div>

</h:form>

SignupBean:它的视图范围

public void displaySignUpScreenAction() {
        if (log.isDebugEnabled()) {
            log.debug("@displaySignUpScreenAction");
        }

        setCompany(new Company());
        setUser(new User());

    }

点击show对话框链接我创建用户对象然后渲染对话框,所以绑定应该工作正常,实际上它工作正常但有时在生产服务器上我在日志中看到如下错误:

value="#{signUpBean.user.firstName}": Target Unreachable, 'user' returned null] with root cause 
Jun 09 17:04:03 myapp i-e38b9c8c: javax.el.PropertyNotFoundException: Target Unreachable, 'user' returned null 
Jun 09 17:04:03 myapp i-e38b9c8c: at org.apache.el.parser.AstValue.getTarget(AstValue.java:147) 
Jun 09 17:04:03 myapp i-e38b9c8c: at org.apache.el.parser.AstValue.getType(AstValue.java:81) 
Jun 09 17:04:03 myapp i-e38b9c8c: at org.apache.el.ValueExpressionImpl.getType(ValueExpressionImpl.java:171) 
Jun 09 17:04:03 myapp i-e38b9c8c: at com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:98) 
Jun 09 17:04:03 myapp i-e38b9c8c: at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:95) 
Jun 09 17:04:03 myapp i-e38b9c8c: at javax.faces.component.UIInput.getConvertedValue(UIInput.java:1046) 
Jun 09 17:04:03 myapp i-e38b9c8c: at javax.faces.component.UIInput.validate(UIInput.java:976) 
Jun 09 17:04:03 myapp i-e38b9c8c: at javax.faces.component.UIInput.executeValidate(UIInput.java:1249) 
Jun 09 17:04:03 myapp i-e38b9c8c: at javax.faces.component.UIInput.processValidators(UIInput.java:712) 
Jun 09 17:04:03 myapp i-e38b9c8c: at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1258) 
Jun 09 17:04:03 myapp i-e38b9c8c: at javax.faces.component.UIForm.processValidators(UIForm.java:253) 
Jun 09 17:04:03 myapp i-e38b9c8c: at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1258) 
Jun 09 17:04:03 myapp i-e38b9c8c: at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1258) 
Jun 09 17:04:03 myapp i-e38b9c8c: at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1258) 
Jun 09 17:04:03 myapp i-e38b9c8c: at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1195) 
Jun 09 17:04:03 myapp i-e38b9c8c: at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76) 
Jun 09 17:04:03 myapp i-e38b9c8c: at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) 
Jun 09 17:04:03 myapp i-e38b9c8c: at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198) 
Jun 09 17:04:03 myapp i-e38b9c8c: at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646) 
Jun 09 17:04:03 myapp i-e38b9c8c: at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) 
Jun 09 17:04:03 myapp i-e38b9c8c: at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) 
Jun 09 17:04:03 myapp i-e38b9c8c: at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 
Jun 09 17:04:03 myapp i-e38b9c8c: at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) 
Jun 09 17:04:03 myapp i-e38b9c8c: at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) 
Jun 09 17:04:03 myapp i-e38b9c8c: at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) 
Jun 09 17:04:03 myapp i-e38b9c8c: at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) 
Jun 09 17:04:03 myapp i-e38b9c8c: at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) 
Less

我正在使用JSF 2.2,请告知为什么有时会出现此错误以及如何解决它。

0 个答案:

没有答案