我遇到了一个奇怪的问题。我用方法签名创建了一个简单的复合组件:
<c:interface>
<c:attribute name="valorBusca" default="" required="true" type="java.lang.String"/>
<c:attribute name="listenerBusca" required="true" method-signature="void buscarAlgo(javax.faces.event.AjaxBehaviorEvent)"/>
<c:facet name="filtrosAdicionais"/>
<c:facet name="tabela"/>
<c:facet name="informacoes"/>
</c:interface>
<c:implementation>
<h:outputStylesheet library="css" name="clearfix.css" target="head"/>
<h:outputStylesheet library="css" name="camposFormulario.css" target="head"/>
<h:outputStylesheet library="css" name="listagem.css" target="head"/>
<h:panelGroup layout="block" styleClass="hrgi-div-form tamanho-aba-cadastro clearfix">
<p:fieldset legend="Filtro" styleClass="clearfix" style="width: 94.5%">
<h:panelGroup layout="block" styleClass="clearfix">
<h:outputLabel value="Buscar:"
title="Insira a informação a ser buscada."
styleClass="hrgi-label-form hrgi-listagem-label" style="padding-right: 8px;"/>
<p:inputText value="#{cc.attrs.valorBusca}"
autocomplete="off" immediate="true" style="width:90%"
title="Insira a informação a ser buscada.">
<f:ajax event="keyup" render="tabelaListagem" execute="@this"
immediate="true" listener="#{cc.attrs.listenerBusca}"/>
</p:inputText>
</h:panelGroup>
<c:renderFacet name="filtrosAdicionais" required="false"/>
</p:fieldset>
<h:panelGroup id="tabelaListagem" layout="block" class="clearfix"
style="width:99%; margin: 1em auto 0 auto;">
<c:renderFacet name="tabela" required="true"/>
</h:panelGroup>
<h:panelGroup id="painelInformacoes" layout="block" styleClass="clearfix">
<p:fieldset legend="Informações" style="width: 94.5%">
<c:renderFacet name="informacoes" required="true"/>
</p:fieldset>
</h:panelGroup>
</h:panelGroup>
它无法正常工作,所以我将glajarra更新为glassfish 3.1.1中的2.1.4版本,但我不知道为什么,它在一个xhtml文件中工作而在另一个文件中不起作用...
这样就可以了:
<ui:composition template="../templates/popup.xhtml">
<ui:param name="titulo"
value="#{vendaMsg['popup.adicionar_produto.titulo']}"/>
<ui:param name="popup" value="#{modeloPopupCarregarProduto}"/>
<ui:param name="controladorPopup"
value="#{controladorPopupCarregarProduto}"/>
<ui:define name="conteudo">
<h:panelGroup layout="block" styleClass="hrgi-div-form clearfix">
<hrgi:listagem listenerBusca="#{controladorPopupCarregarProduto.buscarProdutos}"
valorBusca="#{modeloPopupCarregarProduto.valorBusca}">
.............................
</hrgi:listagem>
</h:panelGroup>
</ui:define>
</ui:composition>
并且根本不适用于此:
<ui:composition template="../templates/popup.xhtml">
<ui:param name="titulo" value="#{cadastroMsg['popup.cadastro.listagem_produto.titulo']}"/>
<ui:param name="popup" value="#{modeloPopupListagemProduto}"/>
<ui:param name="controladorPopup" value="#{controladorPopupListagemProduto}"/>
<ui:define name="conteudo">
<h:panelGroup layout="block" styleClass="hrgi-div-form clearfix">
<hrgi:listagem listenerBusca="#{controladorPopupListagemProduto.buscarProdutos}"
valorBusca="#{modeloPopupListagemProduto.valorBusca}">
.................................
</hrgi:listagem>
</h:panelGroup>
</ui:define>
</ui:composition>
在第二页中,我收到此错误:
javax.el.PropertyNotFoundException: /resources/components/popups/modulo_cadastro/popupListagemProduto.xhtml @18,82 listenerBusca="#{controladorPopupListagemProduto.buscarProdutos}": The class 'com.hrgi.ui.controladores.popups.ControladorPopupListagemProduto' does not have the property 'buscarProdutos'.
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:111)
at com.sun.faces.facelets.el.ContextualCompositeMethodExpression.invoke(ContextualCompositeMethodExpression.java:190)
at com.sun.faces.facelets.tag.TagAttributeImpl$AttributeLookupMethodExpression.invoke(TagAttributeImpl.java:450)
at com.sun.faces.facelets.tag.jsf.core.AjaxBehaviorListenerImpl.processAjaxBehavior(AjaxHandler.java:453)
at javax.faces.event.AjaxBehaviorEvent.processListener(AjaxBehaviorEvent.java:113)
at javax.faces.component.behavior.BehaviorBase.broadcast(BehaviorBase.java:102)
at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:760)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:935)
at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at fr.xebia.servlet.filter.ExpiresFilter.doFilter(ExpiresFilter.java:1243)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:177)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter.doFilter(DefaultLoginPageGeneratingFilter.java:91)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:109)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:169)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:662)
另一个奇怪的事情是,在调试模式下,它进入方法,当方法完成时,抛出此错误!这是我试图调用的方法(与其他正确运行的方法完全相同):
public void buscarProdutos(AjaxBehaviorEvent evento) {
UIInput input = (UIInput) evento.getComponent();
String novoValor = (String) input.getValue();
carregarProdutos(novoValor);
}
我做错了什么我看不见?
答案 0 :(得分:1)
buscarProdutos()
方法本身实际上抛出了一个异常,但由于currently open bug (issue 1806)与复合组件中的调用操作相关,它被吞并并重新抛出为PropertyNotFoundException
。
您可以在调试器中找到 real 异常和/或将方法体放在try-catch
内并记录它。我敢打赌,carregarProdutos()
方法引发了异常。