jsf总是渲染一个xhtml页面

时间:2014-01-29 16:03:58

标签: jsf jsf-2 xhtml render

我正在测试我的新应用程序,当我点击我的表单上的一个按钮时,我有一个问题,它有一个表格,我总是检查一个值,如果它是真的它渲染,如果不是它,并且注册数据按钮。问题是我通过脚本删除表的一些数据,当我点击按钮时它给我一个空指针异常。在日志文件中,它表示它再次呈现页面,然后转到按钮的特定功能,因为我在尝试再次呈现页面时已经删除了数据,给我一个错误500.

这是我的表:

<h:panelGroup id="tab1" rendered="#{DataControl.tabIndex == 1}">
     <h:dataTable>
          <h:column>
              <h:commandButton disabled="#{DataControl.CheckDelete(item.intIdAddress)}" />
           </h:column>
     </h:dataTable>
     <h:commandButton  action="#{DataControl.AddAddress}"  />
</h:panelGroup>
<h:panelGroup id="tab2" rendered="#{DataControl.tabIndex == 2}">
       < Refister Form >
</h:panelGroup>

这是我的checkDelete函数:

public boolean CheckDelete() {
         Util.getLog().info("CheckDelete for id : "+ id);
         if (id.render)
            return true;
         else 
            return false;
     }

这是我的AddAddress函数:

public String AddAddress(){
    Util.getLog().info("Go to Register Div");
    tabIndex = 2;
}

当我在表单中的日志文件并单击按钮时:

Enter to filter : Has Session 
 CheckDelete for id : 1
 CheckDelete for id : 2
 CheckDelete for id : 3
 CheckDelete for id : 4
 Go to Register Div

当我删除数据N°2时,Logs文件是(我在表单中,删除数据,然后我点击按钮):

Enter to filter : Has Session
CheckDelete for id : 1
 javax.el.ELException: /pages/session/account_settings.xhtml @101,253 disabled="#{GeneralDataControl.VerificaEliminacion(item.intIdAddress)}": java.lang.NullPointerException
                                 javax.faces.FacesException: javax.el.ELException: /pages/session/account_settings.xhtml @101,253 disabled="#{GeneralDataControl.VerificaEliminacion(item.intIdAddress)}": java.lang.NullPointerException
    at javax.faces.component.UIComponentBase$AttributesMap.get(UIComponentBase.java:2214)
    at com.sun.faces.util.Util.componentIsDisabledOrReadonly(Util.java:418)
    at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.shouldDecode(HtmlBasicRenderer.java:739)
    at com.sun.faces.renderkit.html_basic.ButtonRenderer.decode(ButtonRenderer.java:77)
    at javax.faces.component.UIComponentBase.decode(UIComponentBase.java:791)
    at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1048)
    at javax.faces.component.UIData.iterate(UIData.java:1477)
    at javax.faces.component.UIData.processDecodes(UIData.java:980)
    at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1043)
    at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1043)
    at javax.faces.component.UIForm.processDecodes(UIForm.java:212)
    at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1043)
    at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1043)
    at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:920)
    at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:74)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1213)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1154)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:145)
    at com.alignet.wallet.cliente.filter.FiltroHibernate.doFilter(FiltroHibernate.java:90)
    at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:848)
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:691)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:654)
    at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:526)
    at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:90)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:764)
    at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1478)
    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:133)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:457)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:515)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:300)
    at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:102)
    at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
    at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
    at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
    at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
    at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:196)
    at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:751)
    at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:881)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1593)
Caused by: javax.el.ELException: /pages/session/account_settings.xhtml @101,253 disabled="#{GeneralDataControl.VerificaEliminacion(item.intIdAddress)}": java.lang.NullPointerException
    at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:111)
    at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:190)
    at javax.faces.component.html.HtmlCommandButton.isDisabled(HtmlCommandButton.java:183)
    at sun.reflect.GeneratedMethodAccessor489.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:619)
    at javax.faces.component.UIComponentBase$AttributesMap.get(UIComponentBase.java:2206)
    ... 44 more
Caused by: java.lang.NullPointerException
    at com.alignet.wallet.cliente.web.GeneralDataJSFAction.VerificaEliminacion(GeneralDataJSFAction.java:388)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:619)
    at javax.el.BeanELResolver.invokeMethod(BeanELResolver.java:737)
    at javax.el.BeanELResolver.invoke(BeanELResolver.java:467)
    at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:246)
    at com.sun.el.parser.AstValue.getValue(AstValue.java:111)
    at com.sun.el.parser.AstValue.getValue(AstValue.java:163)
    at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:219)
    at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:106)
    ... 50 more

似乎jsf总是渲染页面之前做提交,我不知道如何解决这个问题。我认为是配置的事情。

我使用过滤器(唯一的过滤器)检查用户的会话,然后使用“doFilter”让响应继续。

谢谢你的时间。

0 个答案:

没有答案