webtier@glassfish.java.net

JSF 2.0 CompositeComponent with f:ajax inside

From: <webtier_at_javadesktop.org>
Date: Sun, 09 Aug 2009 02:09:32 PDT

Hello,

i have a problem with a composite component. I want to use the f:ajax tag inside. The following error occur:

javax.servlet.ServletException: <f:ajax> contains an unknown id 'result' - cannot locate it in the context of the component btnSave
        javax.faces.webapp.FacesServlet.service(FacesServlet.java:323)

This is the code for the standardComp:userComp:
<!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:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:composite="http://java.sun.com/jsf/composite">
        <h:body>
                <composite:interface>
                        
                        <composite:attribute name="userController" required="true" />
                        <composite:attribute name="renderId" required="true" />
                        <composite:actionSource name="saveEvent" targets="btnSave" />
                        <composite:editableValueHolder name="userNameField" targets="firstname" />
                
</composite:interface>
                
                <composite:implementation>
                        
<h:panelGrid columns="2">
                                <h:outputLabel for="firstname" value="Vorname:" />
                                <h:inputText id="firstname" value="#{cc.attrs.userController.user.firstname}" />
                                        
                                <h:outputLabel for="surname" value="Nachname:" />
                                <h:inputText id="surname" value="#{cc.attrs.userController.user.surname}" />
                        </h:panelGrid>
                        
                        <h:commandButton id="btnSave" value="Update via Ajax" action="#{cc.attrs.userController.saveUser}">
                                <f:ajax execute="firstname surname" render="#{cc.attrs.renderId}" />
                        </h:commandButton>
                
                </composite:implementation>
        </h:body>
</html>

In the site where i call this component, the renderId comes directly after the component.

<standardComp:userComp userController="#{userController}" renderId="result" />
<h:dataTable id="result" value="#{userService.userCache}" var="savedUser" >

 The expression language works. Is this a render problem? This should work, or am i am wrong with this?

yours
finarfin
[Message sent by forum member 'finarfin' (finarfin)]

http://forums.java.net/jive/thread.jspa?messageID=359597