Problems getting jsp:include to work
dkarr Jan 21, 2008 5:08 PMJSF 1.1, RichFaces 3.1.3.
I have a tabPanel where some of the tabs will work identically, such that they will have the same fields, but each instance will go to a different array entry in the backing bean. I've tested and verified the functionality "inline" in the main page, but I think it would be better if I moved the content of the tab into an include file and use "jsp:include" with a parameter from the main page.
On the first try, I'm not even using the passed parameter in the include file (just using a default index of 0 for now). I'll integrate that when everything else is working.
When I first tried it, my "jsp:include" looked like this:
<f:subview id="propertysubview0"> <jsp:include page="/propertyTab.jsp"> <jsp:param name="propertyIndex" value="0" /> </jsp:include> </f:subview>
When I ran this, it gave me an error like:
Error testing property 'propertyID' in bean of type null
I then realized that perhaps my include URI should be "/faces/propertyTab.jsp" (that's the mapping to my Faces Servlet). After I made that change, I instead got the following exception:
java.lang.NullPointerException at com.sun.faces.el.ValueBindingImpl.(ValueBindingImpl.java:98) at com.sun.faces.application.ApplicationImpl.createValueBinding(ApplicationImpl.java:292) at javax.faces.webapp.UIComponentTag.setProperties(UIComponentTag.java:890) at org.ajax4jsf.webapp.taglib.UIComponentTagBase.setProperties(UIComponentTagBase.java:80) at org.ajax4jsf.webapp.taglib.HtmlComponentTagBase.setProperties(HtmlComponentTagBase.java:78) at org.richfaces.taglib.TabTag.setProperties(TabTag.java:568)
My included JSP looks like this:
<%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%> <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> <f:subview id="includedPropertyPage"> <h:panelGrid id="propertyPanelGrid" columns="3"> <h:outputText id="propertyIDOut" value="Property ID"/> <h:inputText id="propertyIDIn" value="#{ratingRequest.propertyList[0].propertyID}"> <a4j:support id="propertyIDInSupport" event="onchange" reRender="propertyTable"/> </h:inputText> <rich:message for="propertyIDIn" showDetail="true"/> <h:outputText id="valueOut" value="Value"/> <h:inputText id="valueIn" value="#{ratingRequest.propertyList[0].value}"> <a4j:support id="valueInSupport" event="onchange" reRender="propertyTable"/> </h:inputText> <rich:message for="valueIn" showDetail="true"/> </h:panelGrid> </f:subview>