隐藏/取消隐藏表格第一行中的按钮

时间:2022-09-26 10:08:52

I have a table that is created using an old JSF component library called Woodstock. I want to show a button just in the first row.

我有一个使用名为Woodstock的旧JSF组件库创建的表。我想在第一行显示一个按钮。

.jsf file:

<webuijsf:form id="reportlist">

<webuijsf:table id="table4" title="#{msg.reports_table_header}">

   <webuijsf:tableRowGroup selected="#{user$recentreports.selectedState}" binding="#{user$recentreports.tableRowGroup}" id="tableRowGroup4"rows="15" sourceData="#{user$recentreports.reportList}" sourceVar="currentRow">
     <webuijsf:tableColumn id="column12" binding="#{user$recentreports.column12}" onClick="setTimeout('initAllRows()', 0)" selectId="#{user$recentreports.selectedCheckBox}">
       <webuijsf:checkbox id="selectedCheckBox" binding="#{user$recentreports.selectedCheckBox}" />
       <webuijsf:button binding="#{user$recentreports.deleteSelectedButton}" actionExpression="#{user$recentreports.deleteButton2_action}" id="deleteSelectedButton" text="#{msg.report_delete_selected}"/>
   </webuijsf:tableColumn>

.java file:

after some getter/setter methods of the UI elements I have the setter method of the column12:

在UI元素的一些getter / setter方法之后,我有了column12的setter方法:

public void setColumn12(TableColumn column12){
    System.out.println("setTableColumn12");//works fine
   buttonTest=Integer.parseInt(tableRowGroup.getRowKey().getRowId());//nullpointer exception comes here
    System.out.println("buttonTest"+ buttonTest);// this never shows up
    this.column12=column12;
}

I want to get the row key and set my button's visible property to false. But I can not, I am getting

我想获取行键并将我的按钮的visible属性设置为false。但我不能,我得到了

[#|2011-10-07T18:27:06.239+0300|WARNING|glassfishv3.0|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=28;_ThreadName=Thread-1;|ApplicationDispatcher[/lrms] PWC1231: Servlet.service() for servlet jsp threw exception
javax.faces.FacesException: javax.el.ELException: java.lang.NullPointerException
    at com.sun.faces.application.ApplicationImpl.createComponentApplyAnnotations(ApplicationImpl.java:1851)
    at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:444)
    at javax.faces.webapp.UIComponentELTag.createComponent(UIComponentELTag.java:222)
    at javax.faces.webapp.UIComponentClassicTagBase.createChild(UIComponentClassicTagBase.java:486)
    at javax.faces.webapp.UIComponentClassicTagBase.findComponent(UIComponentClassicTagBase.java:670)
    at javax.faces.webapp.UIComponentClassicTagBase.doStartTag(UIComponentClassicTagBase.java:1142)
    at org.apache.jsp.user.recentreports_jsp._jspx_meth_webuijsf_tableColumn_0(recentreports_jsp.java from :1929)
    at org.apache.jsp.user.recentreports_jsp._jspx_meth_webuijsf_tableRowGroup_0(recentreports_jsp.java from :1882)
    at org.apache.jsp.user.recentreports_jsp._jspx_meth_webuijsf_table_0(recentreports_jsp.java from :1839)
    at org.apache.jsp.user.recentreports_jsp._jspx_meth_webuijsf_form_0(recentreports_jsp.java from :1795)
    at org.apache.jsp.user.recentreports_jsp._jspService(recentreports_jsp.java from :1549)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:109)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:408)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:483)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:373)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:802)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:664)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:497)
    at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:468)
    at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:364)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:314)
    at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:542)
    at com.sun.faces.application.view.JspViewHandlingStrategy.executePageToBuildView(JspViewHandlingStrategy.java:354)
    at com.sun.faces.application.view.JspViewHandlingStrategy.buildView(JspViewHandlingStrategy.java:130)
    at com.sun.faces.application.view.JspViewHandlingStrategy.renderView(JspViewHandlingStrategy.java:169)
    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:126)
    at com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.renderView(ViewHandlerImpl.java:320)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:127)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:313)
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
    at com.sun.webui.jsf.util.UploadFilter.doFilter(UploadFilter.java:267)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
    at com.labristeknoloji.lcas.client.filters.SingleSignOutNameAddFilter.doFilter(SingleSignOutNameAddFilter.java:56)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
    at org.jasig.cas.client.util.AssertionThreadLocalFilter.doFilter(AssertionThreadLocalFilter.java:40)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
    at org.jasig.cas.client.util.HttpServletRequestWrapperFilter.doFilter(HttpServletRequestWrapperFilter.java:50)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
    at org.jasig.cas.client.validation.AbstractTicketValidationFilter.doFilter(AbstractTicketValidationFilter.java:167)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
    at com.labristeknoloji.lcas.client.filters.LCASAuthenticationFilter.doFilter(LCASAuthenticationFilter.java:111)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
    at org.jasig.cas.client.session.SingleSignOutFilter.doFilter(SingleSignOutFilter.java:104)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
    at com.labristeknoloji.lrms.web.filter.LocaleFilter.doFilter(LocaleFilter.java:76)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:277)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
    at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233)
    at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:229)
    at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:334)
    at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:814)
    at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:743)
    at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:936)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:682)
    at java.lang.Thread.run(Thread.java:619)
Caused by: javax.el.ELException: java.lang.NullPointerException
    at javax.el.BeanELResolver.getValue(BeanELResolver.java:307)
    at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:175)
    at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:72)
    at com.sun.el.parser.AstValue.getValue(AstValue.java:116)
    at com.sun.el.parser.AstValue.getValue(AstValue.java:163)
    at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:219)
    at com.sun.faces.application.ApplicationImpl.createComponentApplyAnnotations(ApplicationImpl.java:1840)
    ... 75 more
Caused by: java.lang.NullPointerException
    at com.labristeknoloji.lrms.faces.user.recentreports.getcolumn12(recentreports.java:70)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at javax.el.BeanELResolver.getValue(BeanELResolver.java:302)
    ... 81 more
|#]

exception. What am I doing wrong? What is the right way to do it?

例外。我究竟做错了什么?这样做的正确方法是什么?

1 个解决方案

#1


0  

In which line is the error? As this is a NullPointException you are passing null somehwere as argument or trying to invoke a method on null.

哪一行是错误的?因为这是一个NullPointException,所以你传递null somehwere作为参数或尝试在null上调用方法。

#1


0  

In which line is the error? As this is a NullPointException you are passing null somehwere as argument or trying to invoke a method on null.

哪一行是错误的?因为这是一个NullPointException,所以你传递null somehwere作为参数或尝试在null上调用方法。