RichFaces portlet and h:selectOneMenu
portletbridgefrankum May 9, 2008 5:15 AMHello,
I've been developing a set of portlets for the 2.6.4 Portal Server, and recently am trying to integrate RichFaces components. I have a portlet that renders properly when using static (defined in the xhtml file) menu items, but when I try to read from a managed bean I get the following error (stack trace snipped):
Cause: javax.portlet.PortletException: Error process faces request Message: Error process faces request StackTrace: javax.portlet.PortletException: Error process faces request at javax.portlet.faces.GenericFacesPortlet.doFacesDispatch(GenericFacesPortlet.java:303) at javax.portlet.faces.GenericFacesPortlet.doView(GenericFacesPortlet.java:263) at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:133) at javax.portlet.faces.GenericFacesPortlet.doDispatch(GenericFacesPortlet.java:244) (snip) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446) at java.lang.Thread.run(Unknown Source) javax.portlet.faces.BridgeException: Error processing render lifecycle at org.jboss.portletbridge.ExceptionHandlerImpl.processRenderException(ExceptionHandlerImpl.java:59) at org.jboss.portletbridge.AjaxPortletBridge.doFacesRequest(AjaxPortletBridge.java:281) at javax.portlet.faces.GenericFacesPortlet.doFacesDispatch(GenericFacesPortlet.java:300) at javax.portlet.faces.GenericFacesPortlet.doView(GenericFacesPortlet.java:263) (snip) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446) at java.lang.Thread.run(Unknown Source) javax.faces.FacesException: java.lang.IllegalArgumentException: Expected a child component type of UISelectItem/UISelectItems for component type javax.faces.SelectOne(provider). Found null. at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:306) at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144) at org.jboss.portletbridge.AbstractAjaxBridge.render(AbstractAjaxBridge.java:137) at org.jboss.portletbridge.AjaxPortletBridge.renderResponse(AjaxPortletBridge.java:305)
My page looks like this:
<?xml version="1.0" ?>
<jsp:root version="2.0" xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.org/rich">
<jsp:directive.page contentType="text/html" />
<jsp:output omit-xml-declaration="no" doctype-root-element="html"
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" />
<f:view>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Portlet Input1</title>
</head>
<body>
<f:loadBundle var="bundle"
basename="com.intersoftkk.foo.jsfbeans.resources.i18n.messages" />
<h:form>
<rich:tabPanel selectedTab="searchList" switchType="client">
<rich:tab name="preferences" label="prefs">
<h:panelGrid columns="3">
<h:panelGroup>
<h:outputText styleClass="portlet-msg-error" value=" * " />
<h:outputLabel value="#{bundle.menu_provider}" for="provider" />
</h:panelGroup>
<h:selectOneMenu id="provider"> <!--
value="#{tableDataBean.providerId}">
-->
<f:selectItems value="#{testBean.items}" />
<f:selectItem itemLabel="aa" itemValue="aa"/>
</h:selectOneMenu>
<h:message for="provider" styleClass="error-message"
showSummary="true" showDetail="false" />
<h:panelGroup>
<h:outputText styleClass="portlet-msg-error" value=" * " />
<h:outputLabel value="#{bundle.menu_service}"
for="service" />
</h:panelGroup>
<h:selectOneMenu id="service" >
<f:selectItem itemLabel="bb" itemValue="cc"/>
</h:selectOneMenu>
<h:message for="service" styleClass="error-message"
showSummary="true" showDetail="false" />
</h:panelGrid>
</rich:tab>
<rich:tab name="searchList" label="search">
<span style="text-align: right"> <h:commandButton id="display"
action="displayValues" value="#{bundle.DISPLAY_PROMPT}"
styleClass="portlet-form-button" /> </span>
</rich:tab>
</rich:tabPanel>
</h:form>
</body>
</html>
</f:view>
</jsp:root>
If I comment out the testBean.items line, the page renders.
The appropriate managed bean method is
public SelectItem[] getItems() {
SelectItem[] ret = new SelectItem[1];
ret[0] = new SelectItem(1,"label");
return ret;
}
I'd appreciate any help. The error messages are less than clear, and searching through the forums showed lots of guesswork. The component demo I downloaded doesn't seem to use a selectOneMenu, and I was trying to avoid incorporating Seam if I don't have to (trying to KISS but it's difficult).
The included libraries in the project include:
commons-beanutils-core.jar
commons-digester-1.8.jar
jsf-facelets.jar
commons-lang-2.3.jar
richfaces-impl-3.2.0.GA.jar
richfaces-ui-3.2.0.GA.jar
portletbridge-impl-1.0.0B2.jar
portletbridge-api-1.0.0B2.jar
commons-collections-3.2.jar
commons-beanutils-1.7.0.jar
jsf-facelets-1.1.14.jar
(and I just realized that I may have collisions with the last two)
I've tried to write the config files following the wiki's advice. I can include them later if needed. I'd appreciate some advice on the selectOne/selectMany components in the RichFaces context.
--Richard Frankum