I'm using JSF Composite Component for reuse component. However, I keep getting a null-pointer error, I follow some of the tutorial I found but none mention this problem.
The stack trace added:
java.lang.NullPointerException
at com.sun.faces.application.view.FaceletViewHandlingStrategy$MethodRetargetHandlerManager$ArbitraryMethodRegargetHandler.retarget(FaceletViewHandlingStrategy.java:1883)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.retargetMethodExpressions(FaceletViewHandlingStrategy.java:772)
at com.sun.faces.facelets.tag.jsf.CompositeComponentTagHandler.applyNextHandler(CompositeComponentTagHandler.java:201)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:190)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:190)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95)
at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:87)
at com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:161)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:972)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:99)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:647)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
at java.lang.Thread.run(Thread.java:745)
I'm using Netbean 8.0, and the JSF is included in a Enterprise Application project, not sure if that cause any difference from a webApplication project.
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:composite="http://xmlns.jcp.org/jsf/composite"
xmlns:f="http://xmlns.jcp.org/jsf/core">
<h:head>
</h:head>
<h:body>
<composite:interface>
<composite:attribute name="action"/>
</composite:interface>
<composite:implementation>
<h:form>
<h:panelGrid columns="2">
<h:panelGroup>Customer Name:</h:panelGroup>
<h:panelGroup>
<h:inputText value="#{MyMB.customer.name}">
<f:validateRegex pattern="(?:[A-Za-z]+\s*)+"/>
</h:inputText>
</h:panelGroup>
<h:panelGroup>Address:</h:panelGroup>
<h:panelGroup>
<h:inputText value="#{MyMB.customer.address}"></h:inputText>
</h:panelGroup>
<h:panelGroup>Date Of Birth:</h:panelGroup>
<h:panelGroup>
<h:inputText value="#{MyMB.customer.dateOfBirth}">
<f:convertDateTime pattern="MM/dd/yyyy"/>
</h:inputText>
</h:panelGroup>
<h:panelGroup>Gender:</h:panelGroup>
<h:panelGroup>
<h:selectOneRadio value="#{MyMB.customer.gender}">
<f:selectItem itemValue="Male" itemLabel="Male"/>
<f:selectItem itemValue="Female" itemLabel="Female"/>
</h:selectOneRadio>
</h:panelGroup>
</h:panelGrid>
<h:commandButton value="Submit" action="#{cc.attrs.action}"></h:commandButton>
</h:form>
</composite:implementation>
</h:body>
</html>
Index.xhtml
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:comp="http://java.sun.com/jsf/composite/comp">
<h:head>
<title>Customers Management</title>
</h:head>
<h:body>
<h:button value="Register Customer" outcome="register.xhtml"></h:button>
<h:button value="Update Customer Info" outcome="update.xhtml"></h:button>
<comp:customerForm action="#{MyMB.findCustomer()}"></comp:customerForm>
<h:panelGrid columns="2">
<h:panelGroup>
</h:panelGroup>
<h:panelGroup>
<h:form>
<h:selectOneListbox style="margin-left: 100px; width:200px; height:120px" value="#{MyMB.customer}">
<f:selectItems value="#{MyMB.listOfCust}"/>
</h:selectOneListbox>
<h:commandButton value="Remove" action="#{MyMB.removeCustomer()}"></h:commandButton>
<h:commandButton value="Update Customer Info" action="update.xhtml"></h:commandButton>
</h:form>
</h:panelGroup>
</h:panelGrid>
</h:body>
</html>
Try this one
<composite:attribute name="action" method-signature="java.lang.String action()"/>
Related
I have a problem when try to validate the rich:calendar component with o:validateOrder.
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:tablas="http://java.sun.com/jsf/composite/tablas"
xmlns:o="http://omnifaces.org/ui"
xmlns:of="http://omnifaces.org/functions"
xmlns:templates="http://java.sun.com/jsf/composite/templates"
>
<body>
<f:metadata>
<f:event type="preRenderView" listener="#{baseController.iniciarConversacion()}" />
</f:metadata>
<ui:composition template="/templates/TemplateABM.xhtml">
<ui:define name="title">
#{msgs['facturacion.abm.generacion.factura.individual.pagina.titulo']}
</ui:define>
<ui:define name="top">
<h1>#{msgs['facturacion.abm.generacion.factura.individual.titulo']}</h1>
</ui:define>
<ui:define name="content">
<h:form id="formFacturaIndividual">
<h:panelGroup id="panelFechas">
<h:inputHidden id="fechaInicioFactura" value="#{facturaController.fechaInicioFactura}">
<f:convertDateTime type="date" pattern="dd/MM/yy"/>
</h:inputHidden>
<h:inputHidden id="fechaFinFactura" value="#{facturaController.fechaFinFactura}">
<f:convertDateTime type="date" pattern="dd/MM/yy"/>
</h:inputHidden>
<h:inputHidden id="fechaEmisionComprobanteUltima" value="#{comprobanteController.fechaEmisionComprobanteUltima}">
<f:convertDateTime type="date" pattern="dd/MM/yy"/>
</h:inputHidden>
</h:panelGroup>
<o:validateOrder id="validacionFechaFacturaMenorAFechaInicioFactura" type="gte" components="fechaFactura fechaInicioFactura"
message="#{msgs['comun.abm.fecha.factura.menor.limite.dia']}" showMessageFor="fechaFactura" />
<o:validateOrder id="validacionFechaFacturaMayorAFechaFinFactura" type="lte" components="fechaFactura fechaFinFactura"
message="#{msgs['comun.abm.fecha.factura.menor.limite.dia']}" showMessageFor="fechaFactura" />
<o:validateOrder id="validacionFechaFacturaMayorAFechaEmisionUltimoComprobante" type="gte" components="fechaFactura fechaEmisionComprobanteUltima"
message="#{of:format1(msgs['comun.abm.fecha.factura.menor.ultimo.comprobante'], comprobanteController.fechaEmisionComprobanteUltima)}" showMessageFor="fechaFactura" />
<o:massAttribute name="disabled" value="#{tipoComprobanteController.entidad == null}">
<rich:panel id="panelDatosFactura" header="#{msgs['facturacion.abm.generacion.padron.panel.datos.factura']}">
<h:panelGrid id="DatosFactura" columns="3">
<h:outputLabel value="#{msgs['facturacion.abm.generacion.padron.fecha.factura']}" for="fechaFactura"/>
<rich:calendar
id="fechaFactura"
datePattern="dd/MM/yyyy"
showWeeksBar="false"
enableManualInput="true"
value="#{generacionFacturacionIndividualController.facturaBean.fechaFactura}"
required="true"
requiredMessage="La Fecha de la Factura es Obligatoria" >
<a4j:ajax event="change" execute="#form" />
</rich:calendar>
<h:panelGroup>
<rich:message for="fechaFactura"/>
</h:panelGroup>
</h:panelGrid>
</rich:panel>
</o:massAttribute>
</h:form>
</ui:define>
</ui:composition>
</body>
</html>
Exception:
java.lang.IllegalArgumentException: All values must implement java.lang.Comparable.
at org.omnifaces.component.validator.ValidateOrder.validateValues(ValidateOrder.java:142)
at org.omnifaces.component.validator.ValidateMultipleFields.validateComponents(ValidateMultipleFields.java:213)
at org.omnifaces.component.validator.ValidatorFamily.processValidators(ValidatorFamily.java:63)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1216)
at javax.faces.component.UIForm.processValidators(UIForm.java:253)
at com.sun.faces.context.PartialViewContextImpl$PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:536)
at org.richfaces.context.MetaComponentProcessingVisitCallback.visit(MetaComponentProcessingVisitCallback.java:73)
at org.richfaces.context.BaseExtendedVisitContext.invokeVisitCallback(BaseExtendedVisitContext.java:103)
at org.richfaces.context.ExtendedExecuteVisitContext.invokeVisitCallback(ExtendedExecuteVisitContext.java:55)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1652)
at javax.faces.component.UIForm.visitTree(UIForm.java:371)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1663)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1663)
at com.sun.faces.context.PartialViewContextImpl.processComponents(PartialViewContextImpl.java:383)
at com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:257)
at org.richfaces.context.ExtendedPartialViewContext.processPartial(ExtendedPartialViewContext.java:263)
at javax.faces.context.PartialViewContextWrapper.processPartial(PartialViewContextWrapper.java:183)
at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1162)
at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76)
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.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at ar.com.filter.HibernateSessionRequestFilter.doFilter(HibernateSessionRequestFilter.java:35)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassCastException: java.util.Date cannot be cast to java.lang.String
at java.lang.String.compareTo(String.java:108)
at java.util.Collections$ReverseComparator.compare(Collections.java:3578)
at java.util.Collections$ReverseComparator.compare(Collections.java:3569)
at java.util.TimSort.countRunAndMakeAscending(TimSort.java:324)
at java.util.TimSort.sort(TimSort.java:189)
at java.util.TimSort.sort(TimSort.java:173)
at java.util.Arrays.sort(Arrays.java:659)
at java.util.Collections.sort(Collections.java:217)
at org.omnifaces.component.validator.ValidateOrder$Type$4.invoke(ValidateOrder.java:99)
at org.omnifaces.component.validator.ValidateOrder$Type$4.invoke(ValidateOrder.java:95)
at org.omnifaces.component.validator.ValidateOrder$Type.validateOrder(ValidateOrder.java:111)
at org.omnifaces.component.validator.ValidateOrder.validateValues(ValidateOrder.java:139)
... 44 more
I debuged the code and the problem is that the rich:calendar component send String instead Date type, this doesn't happen me in other pages i dont know is omnifaces problem or richfaces. Any ideas?
The <o:validateXxx> components are sensitive to their location relative to the target input components. This is very useful to prioritize validation depending on component's own converter and validators.
When placed before the target input components, then they will validate the raw unsubmitted values, and they will run before any of component's own validators.
When placed after the target input components, then they will validate the converted values (if any converter is involved), and they will run after any of component's own validators.
In your particular case, you placed the <o:validateOrder> between those components. This is not the recommended approach. You will end up getting a List filled with Date instances from components above the validator and String instances from components below the validator.
See also the ValidateMultipleFields javadoc (emphasis mine):
This validator can be placed anywhere in the form, but keep in mind that the components will be validated in the order as they appear in the form. So if this validator is been placed before all of the components, then it will be executed before any of the component's own validators. If this validator fails, then the component's own validators will not be fired. If this validator is been placed after all of the components, then it will be executed after any of the component's own validators. If any of them fails, then this validator will not be exeucted. It is not recommended to put this validator somewhere in between the referenced components as the resulting behaviour may be confusing. Put this validator either before or after all of the components, depending on how you would like to prioritize the validation.
I am using GlassFish 3.1.2 and trying to use composite:insertFacet in a composite component, but the HTML Markup is not generated when using my CC.
The same code works fine when I use composite:renderFacet, but I want to understand why composite:insertFacet is not working in that example? and when to use each of them?
This is my login.xhtml file (the Composite component implementation, the "heading" facet is the issue):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:composite="http://java.sun.com/jsf/composite">
<composite:interface>
<composite:editableValueHolder name="nameInput" targets="form:name"/>
<composite:editableValueHolder name="passwordInput" targets="form:password"/>
<composite:editableValueHolder name="inputs"
targets="form:name form:password"/>
<composite:actionSource name="loginButton" targets="form:loginButton"/>
<composite:attribute name="name"/>
<composite:attribute name="password"/>
<composite:attribute name="namePrompt"/>
<composite:attribute name="passwordPrompt"/>
<composite:attribute name="loginValidate"
method-signature="void validateLogin(ComponentSystemEvent e)
throws javax.faces.event.AbortProcessingException"/>
<composite:attribute name="loginAction"
method-signature="java.lang.String action()"/>
<composite:facet name="heading"/>
<composite:facet name="error"/>
</composite:interface>
<composite:implementation>
<h:outputScript library="util" name="login.js" target="head"/>
<h:form id="form" onsubmit="return checkForm(this, '#{cc.clientId}')">
<composite:insertFacet name="heading"/>
<h:panelGrid columns="2">
#{cc.attrs.namePrompt}
<h:panelGroup>
<h:inputText id="name" value="#{cc.attrs.name}"/>
<h:message for="name"/>
</h:panelGroup>
#{cc.attrs.passwordPrompt}
<h:panelGroup>
<h:inputSecret id="password" value="#{cc.attrs.password}" size="8"/>
<h:message for="password"/>
</h:panelGroup>
</h:panelGrid>
<p>
<h:commandButton id="loginButton"
value="#{cc.attrs.loginButtonText}"
action="#{cc.attrs.loginAction}"/>
</p>
</h:form>
<composite:renderFacet name="error"/>
<p><composite:insertChildren/></p>
<p>#{cc.resourceBundleMap.footer}</p>
</composite:implementation>
</html>
index.xhtml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:util="http://java.sun.com/jsf/composite/util"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
<title>#{msgs.loginHeading}</title>
<h:outputStylesheet library="css" name="styles.css" />
</h:head>
<h:body>
<util:login namePrompt="#{msgs.namePrompt}"
passwordPrompt="#{msgs.passwordPrompt}"
name="#{user.name}"
password="#{user.password}"
loginAction="#{user.login}"
loginButtonText="#{msgs.loginButtonText}">
<f:validateLength minimum="4" for="nameInput"/>
<f:validator validatorId="com.corejsf.Password" for="passwordInput"/>
<f:actionListener type="com.corejsf.LoginActionListener" for="loginButton"/>
<f:facet name="heading" styleClass="header">
<div class="prompt">#{msgs.loginPrompt}</div>
</f:facet>
<f:facet name="error" styleClass="error">
<h:messages layout="table" styleClass="error"/>
</f:facet>
<!-- Child component -->
<h:link outcome="register">#{msgs.registerLinkText}</h:link>
</util:login>
<ui:debug/>
</h:body>
</html>
I tried to figure out the reason from the Component Tree, but I was more confused as the insertFacet appears, here is a the section from the Component Tree when using insertFacet:
<UIOutput id="j_idt7" inView="true" rendered="true" transient="false">
<UINamingContainer id="j_idt8" inView="true" rendered="true" transient="false">
error
<HtmlMessages globalOnly="false" id="j_idt10" inView="true" layout="table" redisplay="true" rendered="true" showDetail="false" showSummary="true" styleClass="error" tooltip="false" transient="false"/>
javax.faces.component.COMPOSITE_FACET_NAME
<UIPanel inView="true" rendered="true" transient="false">
<HtmlForm enctype="application/x-www-form-urlencoded" id="form" inView="true" onsubmit="return checkForm(this, '')" prependId="true" rendered="true" submitted="false" transient="false">
header
<div class="prompt">#{msgs.loginPrompt}</div>
<HtmlPanelGrid border="-2147483648" columns="2" id="j_idt15" inView="true" rendered="true" transient="false">
....
The Component Tree when using renderFacet:
<UIOutput id="j_idt7" inView="true" rendered="true" transient="false">
<UINamingContainer id="j_idt8" inView="true" rendered="true" transient="false">
error
<HtmlMessages globalOnly="false" id="j_idt10" inView="true" layout="table" redisplay="true" rendered="true" showDetail="false" showSummary="true" styleClass="error" tooltip="false" transient="false"/>
heading
<div class="prompt">#{msgs.loginPrompt}</div>
javax.faces.component.COMPOSITE_FACET_NAME
<UIPanel inView="true" rendered="true" transient="false">
<HtmlForm enctype="application/x-www-form-urlencoded" id="form" inView="true" onsubmit="return checkForm(this, '')" prependId="true" rendered="true" submitted="false" transient="false">
<UIOutput id="j_idt15" inView="true" rendered="true" transient="false"/>
<HtmlPanelGrid border="-2147483648" columns="2" id="j_idt16" inView="true" rendered="true" transient="false">
....
The <cc:insertFacet> is not intented for the composite itself, but for composite's child which in turn expects a facet which needs to be provided externally.
E.g. a <h:dataTable> which supports a <f:facet name="header"> (poor composite example, but it's just to give the idea):
<cc:implementation>
<h:dataTable>
<cc:insertFacet name="header">
Which is to be used as
<my:composite>
<f:facet name="header">
This has exactly the same effect as doing as below without a composite
<h:dataTable>
<f:facet name="header">
The <cc:insertFacet> is indeed used very rarely.
The <cc:renderFacet> is intented for the composite implementation itself and basically achieves the same as <ui:define>/<ui:insert> in templates and tagfiles.
im using
RichFaces 4.5.1.Final
Weld 2.2.8.Final
Mojarra 2.1.29
JSF 2.1
The problem is when im starting to use template with Facelets and an exception is thrown in this case obviously NullPointerException but if you see the stacktrace is wrapping the exception into another exception and i cant see the real cause of the problem, the original exception. Is important to say that if i coment the NPE code works perfectly. Any ideas that was causing the issue, Facelets, JSF or Weld. this happen with all exception
I have this structure:
Controller
#Named(value="productoController")
#ConversationScoped
public class ProductoController {
public void alta(){
String test = null;
//Throw NPE
test.concat("");
}
}
Page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:templates="http://java.sun.com/jsf/composite/templates">
<ui:composition template="/templates/TemplateABM.xhtml">
<ui:define name="title">
#{msgs['producto.abm.alta.pagina.titulo']}
</ui:define>
<ui:define name="top">
<h1>#{msgs['producto.abm.alta.titulo']}</h1>
</ui:define>
<ui:define name="content">
<templates:productos id="templateProductos"
page="alta"
disableComponents="false"
btnAccionText="#{msgs['comun.abm.boton.guardar']}"
btnAccion="#{productoController.alta()}"
/>
</ui:define>
</ui:composition>
</html>
Templates:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:o="http://omnifaces.org/ui"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:templates="http://java.sun.com/jsf/composite/templates"
>
<!-- INTERFACE -->
<composite:interface>
<composite:attribute name="page" required="true" />
<composite:attribute name="btnAccionText" required="true" />
<composite:attribute name="btnAccion" method-signature="java.lang.String action()" required="true" />
<composite:attribute name="disableComponents" required="true" />
</composite:interface>
<!-- IMPLEMENTATION -->
<composite:implementation>
<f:metadata>
<f:event type="preRenderView" listener="{productoController.iniciarConversacion}" />
</f:metadata>
<h:form id="formABMProducto">
<templates:botonera id="templateBotonera"
margen="8%"
page="#{cc.attrs.page}"
btnAccionText="#{cc.attrs.btnAccionText}"
btnAccion="#{cc.attrs.btnAccion}"
/>
</h:form>
</composite:implementation>
</html>
Template Botonera.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:o="http://omnifaces.org/ui"
xmlns:composite="http://java.sun.com/jsf/composite">
<!-- INTERFACE -->
<composite:interface>
<composite:attribute name="margen" required="true" />
<composite:attribute name="page" required="true" />
<composite:attribute name="btnAccionText" required="false" />
<composite:attribute name="btnAccion" method-signature="java.lang.String action()" required="false" />
<composite:attribute name="btnExportar" method-signature="java.lang.String action()" required="false" />
<composite:attribute name="disabled" required="false" />
<composite:attribute name="execute" required="false" />
<composite:attribute name="oncompleteValue" required="false" />
<composite:attribute name="deshabilitarBotonAccion" required="false" />
<composite:attribute name="habilitarBotonSeguir" required="false" />
<composite:attribute name="habilitarBotonExportar" required="false" />
</composite:interface>
<!-- IMPLEMENTATION -->
<composite:implementation>
<div id="botonera">
<a4j:commandButton
id="btnAccion"
value="#{cc.attrs.btnAccionText}"
action="#{cc.attrs.btnAccion}"
disabled="#{cc.attrs.disabled}"
execute="#{cc.attrs.execute}"
render="#form"
oncomplete="#{cc.attrs.oncompleteValue}"
rendered="#{!cc.attrs.deshabilitarBotonAccion}"
style="margin:0px #{cc.attrs.margen};" />
<h:commandButton
id="btnSeguir"
value="#{msgs['comun.abm.boton.seguir']}"
action="/abm/servicios/alta"
immediate="true"
disabled="#{titularController.deshabilitarBotonSeguir}"
rendered="#{cc.attrs.page eq 'alta' and cc.attrs.habilitarBotonSeguir}" style="margin:0px #{cc.attrs.margen};"/>
<a4j:commandButton
id="btnExportar"
value="#{msgs['facturacion.abm.generacion.padron.boton.exportar']}"
action="#{cc.attrs.btnExportar}"
execute="#{cc.attrs.execute}"
render="#form"
rendered="#{cc.attrs.habilitarBotonExportar}"
style="margin:0px #{cc.attrs.margen};" />
<h:commandButton
id="btnCancelar"
action="#{commonController.reset(cc.attrs.page)}"
immediate="true"
value="#{msgs['comun.abm.boton.cancelar']}"
style="margin:0px #{cc.attrs.margen};" />
<h:commandButton
id="btnAyuda"
value="#{msgs['comun.abm.boton.ayuda']}"
style="margin:0px #{cc.attrs.margen};" />
<a4j:commandButton
id="btnSalir"
value="#{msgs['comun.abm.boton.salir']}"
onclick="#{rich:component('popupConfirmacionSalida')}.show();"
style="margin:0px #{cc.attrs.margen};"
immediate="true" />
</div>
<ui:include src="/templates/common/popup_salida.xhtml" />
</composite:implementation>
</html>
stacktrace:
GRAVE: javax.faces.el.MethodNotFoundException: javax.el.MethodNotFoundException: Método no hallado: com.sun.faces.el.CompositeComponentAttributesELResolver$ExpressionEvalMap#33704fed.btnAccion()
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:91)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:101)
at javax.faces.component.UICommand.broadcast(UICommand.java:315)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:786)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1251)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
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.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at ar.com.filter.HibernateSessionRequestFilter.doFilter(HibernateSessionRequestFilter.java:35)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: javax.el.MethodNotFoundException: Método no hallado: com.sun.faces.el.CompositeComponentAttributesELResolver$ExpressionEvalMap#33704fed.btnAccion()
at org.apache.el.util.ReflectionUtil.getMethod(ReflectionUtil.java:259)
at org.apache.el.parser.AstValue.invoke(AstValue.java:271)
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:273)
at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40)
at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
at com.sun.faces.facelets.el.ContextualCompositeMethodExpression.invoke(ContextualCompositeMethodExpression.java:187)
at com.sun.faces.facelets.tag.TagAttributeImpl$AttributeLookupMethodExpression.invoke(TagAttributeImpl.java:450)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87)
Thanks
Ignacio
Response for User BalusC, i attached the screen and receive the same result with FullAjaxExceptionHandler.
I saw this in the console maybe you can use (this doesnt reflect in the view):
dic 23, 2014 3:45:06 PM com.sun.faces.facelets.el.ContextualCompositeMethodExpression invoke
ADVERTENCIA: jsf.facelets.el.method.expression.invoke.error:javax.el.ELException: java.lang.NullPointerException
dic 23, 2014 3:45:06 PM com.sun.faces.lifecycle.InvokeApplicationPhase execute
We are currently working on creating "standard" JSF components for our current and future projects. One of the components is a table where columns can easily be added.
The table.xhtml is a composite components and looks like this:
<composite:interface>
<composite:attribute name="dataModel" required="true"
type="com.my.jsf.model.BaseDataModel" />
</composite:interface>
<composite:implementation>
<div style="margin-bottom: 4px">
<h:dataTable id="#{cc.clientId}"
value="#{cc.attrs.dataModel.wrappedData}" var="entry" width="100%">
<composite:insertChildren />
</h:dataTable>
</div>
</composite:implementation>
Then there will be a so called dataColumn.xhtml which is responsible for displaying and sorting data ...
<ui:composition ...>
<h:column>
<f:facet name="header">
<h:panelGroup
style="float: left; font-weight: 600; font-size: 1.2em; padding-left: 4px;">
<h:commandLink value="#{title}"
action="#{cc.attrs.dataModel.sort(sortKey)}"
rendered="#{!(empty sortKey)}" />
<h:outputText value="#{title}" rendered="#{empty sortKey}" />
<c:if test="#{cc.attrs.dataModel.isSortOrderAsc(sortKey)}">
<i class="fa fa-sort-alpha-asc" />
</c:if>
<c:if test="#{cc.attrs.dataModel.isSortOrderDesc(sortKey)}">
<i class="fa fa-sort-alpha-desc" />
</c:if>
</h:panelGroup>
</f:facet>
<h:panelGroup>
<h:outputText value="#{value}"
style="font-size: 1.2em; padding-left: 4px;" />
</h:panelGroup>
</h:column>
</ui:composition>
... and additionally a selectionColumn.xhtml which allows the selection of a row:
<ui:composition ...>
<h:column>
<f:facet name="header">
<h:selectBooleanCheckbox id="selectAll" value="false"
onclick="selectAll(this, 'selected#{id}Row');" />
</f:facet>
<h:panelGroup style="display:block; text-align:center">
<h:selectBooleanCheckbox
value="#{cc.atts.dataModel.checkedItems[identifier]}"
id="selected#{id}Row" />
</h:panelGroup>
</h:column>
</ui:composition>
Finally when the composite components and compositions are put together, the whole thing looks like this:
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
...
template="/layout/layoutoriginal.xhtml">
<ui:define name="content">
<h:form id="createForm">
<div class="form_module">
<fieldset>
<legend>Sample</legend>
<my:table dataModel="#{pageNavigationController.dataModel}">
<my:dataColumn title="Firstname" value="#{entry.firstname}" sortKey="FIRSTNAME" />
<my:dataColumn title="Lastname" value="#{entry.lastname}" sortKey="LASTNAME" />
<my:selectionColumn identifier="#{entry.id}" />
</my:table>
</fieldset>
</div>
</h:form>
</ui:define>
</ui:composition>
When the selectionColumn is added to the table then i receive an exception which states:
value="#{cc.attrs.dataModel.checkedItems[identifier]}": JBWEB006017: Target Unreachable, ''dataModel'' returned null
at javax.faces.component.UIInput.updateModel(UIInput.java:857) [jboss-jsf-api_2.1_spec-2.1.29.Final.jar:2.1.29.Final]
at javax.faces.component.UIInput.processUpdates(UIInput.java:739) [jboss-jsf-api_2.1_spec-2.1.29.Final.jar:2.1.29.Final]
at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1244) [jboss-jsf-api_2.1_spec-2.1.29.Final.jar:2.1.29.Final]
at javax.faces.component.UIData.iterate(UIData.java:2013) [jboss-jsf-api_2.1_spec-2.1.29.Final.jar:2.1.29.Final]
at javax.faces.component.UIData.processUpdates(UIData.java:1266) [jboss-jsf-api_2.1_spec-2.1.29.Final.jar:2.1.29.Final]
at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1244) [jboss-jsf-api_2.1_spec-2.1.29.Final.jar:2.1.29.Final]
at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1244) [jboss-jsf-api_2.1_spec-2.1.29.Final.jar:2.1.29.Final]
at javax.faces.component.UIForm.processUpdates(UIForm.java:281) [jboss-jsf-api_2.1_spec-2.1.29.Final.jar:2.1.29.Final]
at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1244) [jboss-jsf-api_2.1_spec-2.1.29.Final.jar:2.1.29.Final]
at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1244) [jboss-jsf-api_2.1_spec-2.1.29.Final.jar:2.1.29.Final]
at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1244) [jboss-jsf-api_2.1_spec-2.1.29.Final.jar:2.1.29.Final]
at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1244) [jboss-jsf-api_2.1_spec-2.1.29.Final.jar:2.1.29.Final]
at javax.faces.component.UIViewRoot.processUpdates(UIViewRoot.java:1223) [jboss-jsf-api_2.1_spec-2.1.29.Final.jar:2.1.29.Final]
at com.sun.faces.lifecycle.UpdateModelValuesPhase.execute(UpdateModelValuesPhase.java:78) [jsf-impl-2.1.29.jar:2.1.29]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.1.29.jar:2.1.29]
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) [jsf-impl-2.1.29.jar:2.1.29]
...
This somehow irritates me as the dataColumn is working just fine and also utilizes the cc.attrs.dataModel >BUT< inside the header. For the selectionColumn, I need the value inside the column, not in the header. So is this part of the problem and if so, is there a workaround without the need to pass the dataModel in the selectionColumn?
P.S.: Because of the working dataColumn I does not added any backing bean code as I assume that the failure is not found in the backing bean ... it must be some kind of JSF lifecycle problem?
UPDATE 1:
A possible but not very elegant workaround: define dataModel as a attribute in selectionColumn.xhtml
...
<h:selectBooleanCheckbox
value="#{cc.attrs.dataModel.checkedItems[identifier]}"
id="selected#{id}Row" />
...
and pass the data model to the
<my:table dataModel="#{pageNavigationController.dataModel}">
<my:dataColumn title="Firstname" value="#{entry.firstname}" sortKey="FIRSTNAME" />
<my:dataColumn title="Lastname" value="#{entry.lastname}" sortKey="LASTNAME" />
<my:selectionColumn identifier="#{entry.id}" dataModel="#{pageNavigationController.dataModel}"/>
</my:table>
I am not very happy with this workaround because the dataColumn already utilizes the cc.attrs.dataModel ... I would appreciate alternative workarounds/solutions.
I'm trying to us JSF composite component in my web application but I run the page and click on nav bar I had this error
UPDATE
I change the <m:link outcome="#{cc.attrs.caption}" value="#{cc.attrs.jsf}" /> to <m:link outcome="#{cc.attrs.caption}" value="#{cc.attrs.jsf}" />
i get this message on link
V: This link is disabled because a navigation case could not be matched
XHTML
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:mnu="http://xmlns.jcp.org/jsf/composite/mnu">
<h:head>
<title>First Mobile JSF page</title>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=no; target-densityDpi=device-dpi"/>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" />
<script src="http://code.jquery.com/jquery-1.9.0.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
<style>
#box1 {
margin-left: 25%;
margin-top: 55%;
width: 50%;
border-style: solid;
}
</style>
</h:head>
<h:body>
<h:form>
<div data-role="page" home="home">
<div data-role="header">
<h1>Add Product</h1>
</div>
<div data-role="content">
<p>Dummy page add Product</p>
</div>
<div data-role="footer" data-postion="fixed">
<div data-role="navbar">
<ul>
<!-- <li>Add Vendor </li>
<li>Add Product </li>
<li>Generator PO </li>-->
<mnu:MenuItem caption="Add Vendor" jsf="V"/>
<mnu:MenuItem caption="Add Product" jsf="P"/>
<mnu:MenuItem caption="Add Product" jsf="O"/>
</ul>
</div>
</div>
</div>
</h:form>
</h:body>
</html>
composite component
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:cc="http://xmlns.jcp.org/jsf/composite"
xmlns:m="http://xmlns.jcp.org/jsf/html">
<!-- INTERFACE -->
<cc:interface>
<cc:attribute name="caption" required="true"/>
<cc:attribute name="jsf" required="true"/>
</cc:interface>
<!-- IMPLEMENTATION -->
<cc:implementation>
<m:commandLink action="#{cc.attrs.jsf}" value="#{cc.attrs.caption}" />
</cc:implementation>
</html>
An Error Occurred:
javax.el.ELException: java.lang.IllegalArgumentException: Cannot convert V of type class java.lang.String to class javax.el.MethodExpression
- Stack Trace
javax.faces.el.EvaluationException: javax.el.ELException: java.lang.IllegalArgumentException: Cannot convert V of type class java.lang.String to class javax.el.MethodExpression
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:101)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
at javax.faces.component.UICommand.broadcast(UICommand.java:315)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
at java.lang.Thread.run(Thread.java:724)
Caused by: javax.el.ELException: java.lang.IllegalArgumentException: Cannot convert V of type class java.lang.String to class javax.el.MethodExpression
at com.sun.el.ExpressionFactoryImpl.coerceToType(ExpressionFactoryImpl.java:79)
at javax.el.ELContext.convertToType(ELContext.java:473)
at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:229)
at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50)
at com.sun.faces.facelets.el.ContextualCompositeValueExpression.getValue(ContextualCompositeValueExpression.java:158)
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
at com.sun.faces.facelets.tag.TagAttributeImpl$AttributeLookupMethodExpression.invoke(TagAttributeImpl.java:465)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87)
... 35 more
Caused by: java.lang.IllegalArgumentException: Cannot convert V of type class java.lang.String to class javax.el.MethodExpression
at com.sun.el.lang.ELSupport.coerceToType(ELSupport.java:417)
at com.sun.el.ExpressionFactoryImpl.coerceToType(ExpressionFactoryImpl.java:77)
... 42 more
- Component Tree
<UIViewRoot id="j_id1" inView="true" locale="en_US" renderKitId="HTML_BASIC" rendered="true" transient="false" viewId="/AddProduct.xhtml"><html xmlns="http://www.w3.org/1999/xhtml"><UIOutput id="j_idt2" inView="true" rendered="true" transient="false"><title>First Mobile JSF page</title> <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=no; target-densityDpi=device-dpi"/> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css"/> <script src="http://code.jquery.com/jquery-1.9.0.min.js"/> <script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"/> <style> #box1 { margin-left: 25%; margin-top: 55%; width: 50%; border-style: solid; } </style></UIOutput><UIOutput id="j_idt4" inView="true" rendered="true" transient="false"><HtmlForm enctype="application/x-www-form-urlencoded" id="j_idt5" inView="true" prependId="true" rendered="true" submitted="true" transient="false"><div data-role="page" home="home"> <div data-role="header"> <h1>Add Product</h1> </div> <div data-role="content"> <p>Dummy page add Product</p> <!--name<h:inputText id="userName" value="#{sampleViewModel.name}" size="5"/> <h:commandButton id="something" value="doSomething" action="#{sampleViewModel.doSomething}"/>--> <div id="box1"><HtmlOutputText escape="false" id="j_idt7" inView="true" rendered="true" transient="false"/></div> </div> <div data-role="footer" data-postion="fixed"> <div data-role="navbar"> <ul> <!-- <li>Add Vendor </li> <li>Add Product </li> <li>Generator PO </li>--><UINamingContainer id="j_idt12" inView="true" rendered="true" transient="false">javax.faces.component.COMPOSITE_FACET_NAME<UIPanel id="j_id6" inView="true" rendered="true" transient="false"><html xmlns="http://www.w3.org/1999/xhtml"> <!-- INTERFACE --><!-- IMPLEMENTATION --><HtmlCommandLink action="#{cc.attrs.jsf}" actionExpression="#{cc.attrs.jsf}" disabled="false" id="j_idt13" immediate="false" inView="true" rendered="true" transient="false"/></html></UIPanel></UINamingContainer><UINamingContainer id="j_idt14" inView="true" rendered="true" transient="false">javax.faces.component.COMPOSITE_FACET_NAME<UIPanel id="j_id6" inView="true" rendered="true" transient="false"><html xmlns="http://www.w3.org/1999/xhtml"> <!-- INTERFACE --><!-- IMPLEMENTATION --><HtmlCommandLink action="#{cc.attrs.jsf}" actionExpression="#{cc.attrs.jsf}" disabled="false" id="j_idt13" immediate="false" inView="true" rendered="true" transient="false"/></html></UIPanel></UINamingContainer><UINamingContainer id="j_idt15" inView="true" rendered="true" transient="false">javax.faces.component.COMPOSITE_FACET_NAME<UIPanel id="j_id6" inView="true" rendered="true" transient="false"><html xmlns="http://www.w3.org/1999/xhtml"> <!-- INTERFACE --><!-- IMPLEMENTATION --><HtmlCommandLink action="#{cc.attrs.jsf}" actionExpression="#{cc.attrs.jsf}" disabled="false" id="j_idt13" immediate="false" inView="true" rendered="true" transient="false"/></html></UIPanel></UINamingContainer></ul> </div> </div> </div></HtmlForm></UIOutput></html></UIViewRoot>
- Scoped Variables
Request Parameters
Name
Value
j_idt5 j_idt5
j_idt5:j_idt12:j_idt13 j_idt5:j_idt12:j_idt13
View Attributes
Name
Value
None
Request Attributes
Name
Value
None
Flash Attributes
Name
Value
None
Session Attributes
Name
Value
None
Application Attributes
Name
Value
csfcff [ ]
The <h:commandLink> is intented as form submit link, not as page navigation link.
Use <h:link> instead.
So, replace
<m:commandLink action="#{cc.attrs.jsf}" value="#{cc.attrs.caption}" />
by
<m:link outcome="#{cc.attrs.jsf}" value="#{cc.attrs.caption}" />
(and, to be respectful and friendly towards readers of your code, rename xmlns:m to xmlns:h)
See also:
When should I use h:outputLink instead of h:commandLink?