Recursive nesting of Facelet Composite Components

I use JSF2.0 Facelets and Composite Components. I want to display a hierarchical questionary, where the questionary contains a Category List, and any Category can contains subCategories and Questions. In fact, Category inherits from abstract Question class, and we have also some other non-abstarct Question class, like IntQuestion, BooleQuestion, etc.
I defined a Composite Component for Category:
    <!-- INTERFACE -->
    <cc:interface>
        <cc:attribute name="category"/>
    </cc:interface>
    <!-- IMPLEMENTATION -->
    <cc:implementation>
        <h3><h:outputText value="#{category.label} " /></h3>
        <ui:repeat value="#{category.subCategories}" var="subcat">
            <h:panelGroup rendered="#{cc.attrs.category.type == 'Category'}">
                    <ez:category category="${subcat}" />
            </h:panelGroup>
            <h:panelGroup rendered="#{cc.attrs.category.type == 'IntQuestion'}">
                <h:outputText value="#{cc.attrs.category.label} " />
                <h:inputText value="#{myBean.answersByQuestion[cc.attrs.category].answer}" />
            </h:panelGroup>
            <!--More types of Questions-->
        </ui:repeat>
    </cc:implementation>So my Questionary Page would be very short:
                <ui:repeat value="#{myBean.questionary.categories}" var="cat">
                    <ez:category category="${cat}" />
                </ui:repeat>But unfortunately nested composite components are put together before EL-expressions sre resolved, so we get an infinite loop (StackOverflow).
Do you have some idea to correct this composition?
Edited by: GezaCH on Jul 28, 2010 3:28 PM

I wrote something like that about a year ago, and it wasn't hard, and didn't take long time, so you should be able to write code for that in less than an hour if you know about reflection.
Kaj

Similar Messages

  • How to carry across a Facet through nested composite components

    Hello
    I have two nested composite components, with an inner component that does interesting things, and an outer that groups some child components in a convenient package. I would like to use a Facet in the inner component, and it would be nice if you could declare it on the outer component and have it passed through. But I am unable to achieve this, and there is no documentation on how it should work.
    I've made a test project where I try to use insertFacet in the outer component.
    Main page '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:test="http://java.sun.com/jsf/composite/facettest">
        <h:head>
            <title>NestedFacetTest</title>
        </h:head>
        <h:body>
            <div>PageTopElement</div>
            <test:outerCC>
                <f:facet name="testFacet">
                    <div>FacetElement</div>
                </f:facet>
            </test:outerCC>
            <div>PageBottomElement</div>
            <br/>
            <div>PageTopElement2</div>
            <test:innerCC>
                <f:facet name="testFacet">
                    <div>FacetElement2</div>
                </f:facet>
            </test:innerCC>
            <div>PageBottomElement2</div>
        </h:body>
    </html>The outer composite component 'outerCC.xhtml' where I would like the Facet to be carried across:
    <?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:composite="http://java.sun.com/jsf/composite"
          xmlns:test="http://java.sun.com/jsf/composite/facettest">
        <!-- INTERFACE -->
        <composite:interface>
            <composite:facet name="testFacet"/>
        </composite:interface>
        <!-- IMPLEMENTATION -->
        <composite:implementation>
            <div>OuterTopElement</div>
            <test:innerCC>
                <composite:insertFacet name="testFacet"/>
            </test:innerCC>
            <div>OuterBottomElement</div>
        </composite:implementation>
    </html>The inner composite component 'innerCC.xhtml' where I would like to use the Facet:
    <?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:composite="http://java.sun.com/jsf/composite">
        <!-- INTERFACE -->
        <composite:interface>
            <composite:facet name="testFacet"/>
        </composite:interface>
        <!-- IMPLEMENTATION -->
        <composite:implementation>
            <div>InnerTopElement</div>
            <composite:renderFacet name="testFacet"/>
            <div>InnerBottomElement</div>
        </composite:implementation>
    </html>When I run the main page, I get the Facet text when I use innerCC directly, but not when I use outerCC. What do I do wrong, and how can I change the code so that the Facet is carried through to a nested composite component?
    I run GlassFish 3 with Mojarra 2.0.2 (FCS b10).
    Kind regards,
    Thomas Jahnsen

    I added an issue to Mojarra:
    http://java.net/jira/browse/JAVASERVERFACES-2219
    Feel free to vote for this that it will be implemented earlier.

  • Composite components with logic in JSF 1.2

    Hi there,
    I wonder if anyone could direct me to a god, top-to-bottom, easy to follow tutorial on how to create custom composite components in JSF 1.2 with server-side logic. I've read on this forum (http://forums.sun.com/thread.jspa?forumID=427&threadID=5353923) that the version 1.1 was actually easier in this regard but unfortunately I'm bound to work with 1.2 and still need to solve the problem. Here's what I need:
    I need a composition component composed of an h:inputText and rich:calendar as icon-only. I need to be able to add some custom JavaScript on top of the page (once and only once), be able to bind the component's value to a bean (that'd be at the value bound to the h:inputText being part of the composition) and set a couple of additional properties that either be propagated to the rich:calendar, h:inputText or just be used during the custom rendering process.
    The reason for that is that the rich:calendar component does not allow arbitrary text to be stored in the backing bean which is a strong requirement for the application I'm writing. The user-entered text is then transfered over the wire and must stay exactly the same as it was entered. Another point to make is that the controls need to be in a particular envelope (a table with single row and two cells) for proper scaling in the parent table cell.
    So far I've tried to do it using Facelets (which failed due to the fact that the final control needs to have id composed of parent's id and some text which is not usable from within the call to rich:clientId(...)), I've tried to add controls to a parent control (which failed because the value was not stored properly in the backing bean) and tried to extend the rich:calendar control to add the separate h:inputText to it (which sort of worked, but didn't store/restore the state to/from the backing bean. In the last two approaches I've been adding the components in encodeAll() if they were not already there in the getChildren() list.
    I'm desperate!!!
    Thanks for your help!

    To be more specific (if anyone here knows ASP.NET): The UserControl has something called Page, that component has Header and Body, if I add something to the Header (like Link for one) then it'll appear in the head section of my page.
    I need the component to add one JavaScript file that will contain my client-side logic (it's not trivial nor short so it needs to be externalized).
    Apart from that it's not doable for me to do all the rendering for myself because the controls I'm using have to be from RichFaces (architect's decision - not mine). So all I can do is either manually glue things together in the xhtml template directly and add the necessary JS to the template (again: manually), or create a compound component that will be composed of the two components that already do what I need them to do and add the necessary additional JS file automatically when the component is added to the page.
    However what I wanted to do is to create a component that will reuse the functionality of one of the RF components and add an input field in front of it that'll hold String and not Date (like the cumbersome RF component does).
    Can you help?
    Edited by: padcom on Jun 7, 2010 12:15 PM

  • Children problem with composite components

    Hi,
    I'm using Mojarra 2.0.2-FCS and playing with JSF 2.0 composite components.
    I have a simple composite component named textRow which puts a label and input text. Here is the code:
    <composite:interface>
        <composite:attribute name="label" required="true" />
        <composite:attribute name="value" />
    </composite:interface>
    <composite:implementation>
        <h:outputLabel value="#{cc.attrs.label}" />
        <h:inputText value="#{cc.attrs.value}" />
    </composite:implementation>When I use this composite component inside a h:panelGrid with 2 columns (like code fragment below), first component goes to first column, second component goes to second column. But this is not what I want. I want to put all the labels to the first column and inputs to the second. How can I make this?
    <h:panelGrid columns="2">
        <my:textRow label="firstName" />
        <my:textRow label="surName" />
    </h:panelGrid>

    Hi Anca
    You can just type it in.

  • JSF 2.0: Composite Components and their ID

    I'm using Composite Components with JSF 2.0.
    Template:
    <composite:interface />
    <composite:implementation>
        <h:inputText id="text" />
    </composite:implementation>Template Client:
    <h:form id="form">
        <components:myComponent />
    </h:form>In the rendered result, the h:inputText's id will be "form:j_id1060595728_4b62ee3:text".
    How can I override that default ID?
    I tried to set an id attribute on composite:interface and composite:implementation, however, that doesn't have any effect.
    Using ui:debug, I found that the component with ID "j_id1060595728_4b62ee3" is a UINamingContainer.
    When using my own UINamingContainer implementation, i.e., ...
    <composite:interface componentType="util.jsf.UINamingContainerWithID" />
    @FacesComponent("util.jsf.UINamingContainerWithID")
    public class UINamingContainerWithID extends UINamingContainer {
         private String id = "foo";
         @Override
         public String getId() {
              return id;
         @Override
         public void setId(String id) {
              // this.id = id;
         public void setFooID(String id) {
              this.id = id;
    }... I can prevent the id from being set in setId(String), and h:inputText's id will be "form:foo:text".
    (I have tried to debug but the source code is slightly out of sync.)
    I also tried to add an attribute fooID to composite:interface and composite:implementation, with no effect.
    How do you work with Composite Components and their IDs?
    Thanks

    All composite components are NamingContainers. This is necessary to prevent ID collisions.
    In order to avoid a generated ID on a particulare composite component, specify an ID in the component
    within the using page:
    <h:form id="form">
        <components:myComponent id="c" />
    </h:form>So the client ID of the text component would be: form:c:text.

  • JSF 2.0 Composite components

    Hello
    I've learning and testing JSF 2.0 for fun on the latest few days, and i'm try to check if something is possible to do with composite components.
    Most o examples that I have seen do something like this:
    <util:myform image="#{resource['images:back.jpg']}"
    actionMethod="#{places.logout}"
    style="border: thin solid lightBlue"/>
    but i want to have something like:
    <util:mycomp image="#{resource['images:back.jpg']}"
    actionMethod="#{places.logout}"
    style="border: thin solid lightBlue">
    <p>insert some HTML and JSF tags here</p>
    </util:mycomp>
    where i want to grab inside my composite component the "<p>insert some HTML and JSF tags here</p>".
    Is it possible? Is there any example of this feature?
    Thanks

    Hi,
    Not sure I understand fully what you are looking to do but this my help you -
    This is a Composite Component declared in the resources folder...
    <!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:cc="http://java.sun.com/jsf/composite">
        <head>
            <title/>
        </head>
        <h:body>
            <cc:interface />
            <cc:implementation>           
                <h:form>
                    <div>
                        <h5><h:outputLabel value="Email:" /></h5>
                        <h:inputText label="Email" id="email" style="margin-bottom:4px; width: 172px;"
                           validator="#{securityBean.validateEmail}" value="#{securityBean.email}" />
                        <h5><h:outputLabel value="Password:" /></h5>
                        <h:inputSecret  label="Password" id="password" value="#{securityBean.password}"
                             style="width: 172px;" validator="#{securityBean.validatePassword}"/>
                        <h:commandButton value="Register" type="reset" styleClass="logbt"  />
                        <h:commandButton value="Login" action="#{securityBean.performLogin}" styleClass="logbt"  />
                    </div>
                </h:form>
            </cc:implementation>
        </h:body>
    </html>And then you would be able to reuse it using something like
    <!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://java.sun.com/jsf/composite"
          xmlns:ro="http://java.sun.com/jsf/composite/components">
          <ro:loginPanel />                Hope this helps
    Regards
    Patrick

  • Nested Tables and Business Components

    Hi,
    We have developed a paradigm whereby all of our tables are of object types. In one example we haveL
    create type addresslines_nt as table of varchar2(30);
    We have another type:
    create type address_ot as object(
    lines addresslines_nt );
    We create the TABLE off of address_ot with a nested table (store as) off LINES.
    CREATE TABLE ADDRESS of ADDRESS_OT ....
    In JDeveloper we want to create BUSINESS COMPONENTS and can not find a way for it (JDeveloper) to create a matching component for ADDRESS (the table) without it dropping a reference to the LINES property?
    HELP!
    Dave

    BC4J version 3.2.x only supports VARRAY collection types.
    BC4J 9i (which will come with JDeveloper 9i when it's release) supports both VARRAY and TABLE collection types.

  • Cannot get facelets custom components to work

    Hi,
    I'm switching to facelets but I fail to get my custom components to work. I hope any of you can help me point out what is going wrong. My component is built into a seperate jar file:
    package be.xxx.web.tag;
    import java.io.IOException;
    import javax.faces.component.UIOutput;
    import javax.faces.context.FacesContext;
    import javax.faces.context.ResponseWriter;
    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;
    public class IfTag extends UIOutput {
         public IfTag() {
              super();
              Log log = LogFactory.getLog(IfTag.class);
              log.debug("THIS IS THE IFTAG FACELETS IMPLEMENTATION");
              setRendererType(null);
         public boolean getRendersChildren() {
              return true;
         @Override
         public void encodeBegin(FacesContext facesContext) throws IOException {
              // We're rendering a table row
              facesContext.getResponseWriter().startElement("span", null);
         @Override
         public void encodeChildren(FacesContext facesContext) throws IOException {
              ResponseWriter writer = facesContext.getResponseWriter();
              writer.append("This if the IF tag");
         @Override
         public void encodeEnd(FacesContext facesContext) throws IOException {
              facesContext.getResponseWriter().endElement("span");
         @Override
         public String getFamily() {
              return COMPONENT_TYPE;
    }The taglib file in META-INF of the jar file:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE facelet-taglib PUBLIC "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN" "http://java.sun.com/dtd/facelet-taglib_1_0.dtd">
    <facelet-taglib>
         <namespace>http://www.xxx.be/jsf/mw</namespace>
         <tag>
              <tag-name>menu</tag-name>
              <component>
                   <component-type>be.xxx.web.Menu</component-type>
              </component>
         </tag>
         <tag>
              <tag-name>if</tag-name>
              <component>
                   <component-type>be.xxx.web.If</component-type>
              </component>
         </tag>
    </facelet-taglib>Also in META-INF of the same jar, a faces-config.xml:
    <?xml version="1.0" encoding="utf-8"?>
    <faces-config xmlns="http://java.sun.com/xml/ns/javaee"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
                  version="1.2">
      <component>
        <component-type>be.xxx.web.Menu</component-type>
        <component-class>be.xxx.web.tag.MenuTag</component-class>
      </component>
      <component>
        <component-type>be.xxx.web.If</component-type>
        <component-class>be.xxx.web.tag.IfTag</component-class>
      </component>
    </faces-config>Finally, in the main project where the jar with above files is used, I try to call a custom tag:
    <html xmlns="http://www.w3.org/1999/xhtml"
         xmlns:mw="http://www.xxx.be/jsf/mw"
         xmlns:ui="http://java.sun.com/jsf/facelets">
    <mw:if></mw:if>
    </html>The result is that the if tag just writed out nothing, so "<mw:if></mw:if>" in the output just becomes "".
    I haven't found a way to debug this either (as in: I don't think the java code is even executed), so any tips would be greatly appreciated!
    Thanks

    Looks like I posted the wrong class. Here is the problematic one:
    public class MenuTag extends FacesBean implements BodyTag {
         private transient PageContext pc = null;
         private transient Tag parent = null;
         private transient BodyContent bodyContent;
         public void setPageContext(PageContext p) {
              pc = p;
         public void setParent(Tag t) {
              parent = t;
         public Tag getParent() {
              return parent;
         public int doStartTag() throws JspException {
              String url = null;
              try {
                   WebSession ws = (WebSession) getBean("ws");
                   if (ws.isLoggedIn()) {
                        // Get the value of the applicable menu rule
                        url = ws.getPolicy().getMenu();
                        if (url != null && !"".equals(url)) {
                             // Some logic to get correct file
                             String inputLine;
                             while ((inputLine = in.readLine()) != null)
                                  pc.getOut().write(inputLine);
                             in.close();
                             // We printed the menu, so skip the default menu
                             // that is in this tag's body.
                             return SKIP_BODY;
                   } else {
                        getLog().info("The user is not logged in, reverting to default menu.");
              } catch (FileNotFoundException ex) {
                   getLog().warn("Menu file not found (" + url + "), reverting to default menu.");
              } catch (Exception ex) {
                   throw new JspTagException("Error when applying the menu rule.", ex);
              return EVAL_BODY_BUFFERED;
         public int doEndTag() throws JspException {
              try {
                   if (bodyContent != null) {
                        bodyContent.writeOut(bodyContent.getEnclosingWriter());
              } catch (IOException e) {
                   throw new JspException("Error: " + e.getMessage());
              return EVAL_PAGE;
         public void release() {
              pc = null;
              parent = null;
         private String resolveServerUrl() {
              HttpServletRequest req = (HttpServletRequest) FacesContext
                        .getCurrentInstance().getExternalContext().getRequest();
              String url = req.getScheme() + "://" + req.getServerName();
              if (req.getServerPort() != 80) {
                   url += ":" + req.getServerPort();
              return url;
         public void doInitBody() throws JspException {
         public void setBodyContent(BodyContent bc) {
              bodyContent = bc;
         public int doAfterBody() throws JspException {
              return 0;
    }So, problem is that this is not working in facelets as a component, while it did in JSP's.
    Can I get any hints what I am doing wrong here?
    Thanks

  • Can I render facelet  to string in memory ?

    Hi,
    I've been working on porting an existing asp.net web app to a facelets based solution, and there is a particular method which is used quite frequently in the asp.net project. A component, with an ascx extension is loaded dynamically, and rendered to string, which is later either passed via ajax calls or used for decorating a portion of a page.
    Is it possible to render facelet composite components like this? Like passing a pojo to a composite control and rendering the output as string?
    Kind regards
    Seref

    Hi Nick,
    That's a valid suggestion for the LabVIEW developers (post it using the "feedback" link on ni.com/contact), but I'm afraid that it would invite customers to mess up things by not keeping references in a short leash and closing in the right order when done.
    In case you want the closest to this kind of feature, try the Request Deallocation function and place it inside the VI that holds the references. When that VI finishes and returns to the caller, all unused memory will be deallocated.
    - Philip Courtois, Thinkbot Solutions

  • Using a composite component from an xhtml that is included in another xhtml

    JBoss 7.1.1
    JSF 2.1
    I have the following composite component:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <ui:component xmlns="http://www.w3.org/1999/xhtml"
            xmlns:h="http://java.sun.com/jsf/html"
            xmlns:composite="http://java.sun.com/jsf/composite"
            xmlns:f="http://java.sun.com/jsf/core"
            xmlns:ui="http://java.sun.com/jsf/facelets"
            xmlns:rich="http://richfaces.org/rich">
            <composite:interface>
                <composite:attribute name="for" required="true" />
            </composite:interface>
            <composite:implementation>
                <rich:panel styleClass="aas-msg-tt-p">
                    <rich:message id="#{cc.attrs.for}-msg"
                        for="#{cc.attrs.for}" />
                    <rich:tooltip id="#{cc.attrs.for}-msg-tt">
                        <rich:message for="#{cc.attrs.for}"
                            styleClass="aas-rf-det-tooltip" />
                    </rich:tooltip>
                </rich:panel>
            </composite:implementation>
    </ui:component>It is in WebContent/resources/aas-composite/messagetooltip.xhtml ( where WebContent is the root directory or root context directory of the deployed WAR )
    h3. *1. Using the composite component and working as expected*
    If I use the composite component directly as follows, it all works:
    1) Create test.xhtml in WebContent
    2) Content of test.xhtml as follows:
    <!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:a4j="http://richfaces.org/a4j"
          xmlns:rich="http://richfaces.org/rich"
          xmlns:aas="http://java.sun.com/jsf/composite/aas-composite">
    <h:head>
        <meta http-equiv="X-UA-Compatible" content="IE=8" />
    </h:head>
    <h:body>
        <h:outputStylesheet library="css" name="richfacesoverrides.css"/>
        <h:form id="testform">
           <table>
                <tr>
                    <td><aas:messagetooltip for="id2"/></td>
                    <td><h:outputLabel>Input 2: </h:outputLabel></td>
                    <td><h:selectOneMenu id="id2"
                            required="true"
                            requiredMessage="Cause of Death is required"
                            value="${death.causeOfDeath}">
                           <f:selectItem itemValue="" itemLabel="-- Select One --" />
                           <f:selectItem itemValue="COD01" itemLabel="Cancer" />
                           <f:selectItem itemValue="COD02" itemLabel="Diabetes" />
                           <f:selectItem itemValue="COD11" itemLabel="Other" />
                        </h:selectOneMenu>
                    </td>
                </tr>
           </table>
           <h:commandButton id="submit" value="Submit"/><br/>
    </h:form>
    </h:body>
    </html>3) Deploy and test, all good
    h3. *2. Using the composite component but NOT working as expected*
    Now if I use the composite component as follows:
    4) Create XHTML file called includeThisFromRoot.xhtml under WebContent directory
    5) with content as follows:
    <!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:a4j="http://richfaces.org/a4j"
          xmlns:rich="http://richfaces.org/rich"
          xmlns:aas="http://java.sun.com/jsf/composite/aas-composite">
        <ui:composition>
           <table>
                <tr>
                    <td><aas:messagetooltip for="id2"/></td>
                    <td><h:outputLabel>Input 2: </h:outputLabel></td>
                    <td><h:selectOneMenu id="id2"
                            required="true"
                            requiredMessage="Cause of Death is required"
                            value="${death.causeOfDeath}">
                           <f:selectItem itemValue="" itemLabel="-- Select One --" />
                           <f:selectItem itemValue="COD01" itemLabel="Cancer" />
                           <f:selectItem itemValue="COD02" itemLabel="Diabetes" />
                           <f:selectItem itemValue="COD11" itemLabel="Other" />
                        </h:selectOneMenu>
                    </td>
                </tr>
           </table>
           <h:commandButton id="submit" value="Submit"/><br/>
        </ui:composition>
    </html>6) Make a copy test.xhtml, but call the new one testWithInclude.xhtml, with content as follows:
    <!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:a4j="http://richfaces.org/a4j"
          xmlns:rich="http://richfaces.org/rich"
          xmlns:aas="http://java.sun.com/jsf/composite/aas-composite">
    <h:head>
        <meta http-equiv="X-UA-Compatible" content="IE=8" />
    </h:head>
    <h:body>
        <h:outputStylesheet library="css" name="richfacesoverrides.css"/>
        <h:form id="testform">
            <ui:include src="includeThisFromRoot.xhtml" />
        </h:form>
    </h:body>
    </html>h3. Summary of change
    You can see here that I simply moved all of the content between the form tags from the original XHTML to a separate XHTML, and included that separate XHTML using <ui:include>.
    h3. Result
    7) Deploy and access testWithInclude.jsf from browser, and I get:
    15:17:55,310 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/richfacestest].[Faces Servlet]] (http--0.0.0.0-8081-5) Servlet.service() for servlet Faces Servlet threw exception: javax.faces.view.facelets.TagException: /includeThisFromRoot.xhtml @13,52 <aas:messagetooltip> Tag Library supports namespace: http://java.sun.com/jsf/composite/aas-composite, but no tag was defined for name: messagetooltip
            at com.sun.faces.facelets.compiler.CompilationManager.pushTag(CompilationManager.java:304) [jsf-impl-2.1.7-jbossorg-2.jar:]
            at com.sun.faces.facelets.compiler.SAXCompiler$CompilationHandler.startElement(SAXCompiler.java:266) [jsf-impl-2.1.7-jbossorg-2.jar:]
            at org.apache.xerces.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:496)
            at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:180)
            at org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(XMLDTDValidator.java:810)
            at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:275)
            at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1653)
            at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:324)
            at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:845)
            at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:768)
            at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:108)
            at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1196)
            at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:555)
            at org.apache.xerces.jaxp.SAXParserImpl.parse(SAXParserImpl.java:289)
            at javax.xml.parsers.SAXParser.parse(SAXParser.java:195) [rt.jar:1.7.0_09]
            at com.sun.faces.facelets.compiler.SAXCompiler.doCompile(SAXCompiler.java:434) [jsf-impl-2.1.7-jbossorg-2.jar:]
            at com.sun.faces.facelets.compiler.SAXCompiler.doCompile(SAXCompiler.java:410) [jsf-impl-2.1.7-jbossorg-2.jar:]
            at com.sun.faces.facelets.compiler.Compiler.compile(Compiler.java:124) [jsf-impl-2.1.7-jbossorg-2.jar:]
            at com.sun.faces.facelets.impl.DefaultFaceletFactory.createFacelet(DefaultFaceletFactory.java:305) [jsf-impl-2.1.7-jbossorg-2.jar:]
            at com.sun.faces.facelets.impl.DefaultFaceletFactory.access$100(DefaultFaceletFactory.java:93) [jsf-impl-2.1.7-jbossorg-2.jar:]
            at com.sun.faces.facelets.impl.DefaultFaceletFactory$1.newInstance(DefaultFaceletFactory.java:160) [jsf-impl-2.1.7-jbossorg-2.jar:]What gives ? Am I missing something simple ?

    I think I may have found a workaround.
    In the XHTML file that is included and using the composite component, add the namespace as part of the custom component, like so:
    <aas:messagetooltip xmlns:aas="http://java.sun.com/jsf/composite/aas-composite" for="id2"/>So that it now becomes:
    <!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:a4j="http://richfaces.org/a4j"
          xmlns:rich="http://richfaces.org/rich"
          xmlns:aas="http://java.sun.com/jsf/composite/aas-composite">
        <ui:composition>
           <table>
                <tr>
                    <td><aas:messagetooltip xmlns:aas="http://java.sun.com/jsf/composite/aas-composite" for="id2"/></td>
                    <td><h:outputLabel>Input 2: </h:outputLabel></td>
                    <td><h:selectOneMenu id="id2"
                            required="true"
                            requiredMessage="Cause of Death is required"
                            value="${death.causeOfDeath}">
                           <f:selectItem itemValue="" itemLabel="-- Select One --" />
                           <f:selectItem itemValue="COD01" itemLabel="Cancer" />
                           <f:selectItem itemValue="COD02" itemLabel="Diabetes" />
                           <f:selectItem itemValue="COD11" itemLabel="Other" />
                        </h:selectOneMenu>
                    </td>
                </tr>
           </table>
           <h:commandButton id="submit" value="Submit"/><br/>
        </ui:composition>
    </html>I tried this after finding a similar bug about nested composite components, which I do not use, but thought I would give it a try:
    http://stackoverflow.com/questions/10898906/myfoo-tag-library-supports-namespace-http-java-sun-com-jsf-composite-mycom
    http://stackoverflow.com/questions/9735593/nested-composite-component-broken-in-jboss-7-1-1
    Have to keep track of all these workarounds that I am doing.

  • JSF 1.2 style facelets custom tags in JSF 2.0

    Ahoy.
    Using facelets with JSF 1.2, one could create a custom tag in an xhtml file along the lines of:
    labelledInput.xhtml:
    <ui:component>
        <h:outputLabel value="#{label}: ">
            <h:inputText value="#{value}"/>
        </h:outputLabel>
    </ui:component>
    ...You could register it in faces-config.xml or somewhere and then use it with <custom:labeledInput label="Type Something: " value="#{bean.value}"/>.
    Alternatively, one could use <ui:composition> instead of <ui:component> in which case the tag wouldn't be considered as a component.
    I think it could possibly be done with composite components, but they're not quite the same, and their documentation is pretty limited (at least until some of the books come out this year).
    I want to use these more as shortcuts to reduce code duplication rather than adding functionality and they seemed to work well in the past for this.
    If they can't be used, is there a way of creating a composite component that doesn't act as a component?
    In particular, I want to make a tag that contains two components:
    - a label
    - a panel group containing an input and a message for that input
    Then I can add a bunch of these to a 2-column panel grid for a nicely formatted form. Doing it with composite components forces each tag to be a single component, which I don't want. Old-facelets <ui:composition> based tags would let me do this (I think.)

    Hello,
    You posted in the wrong forum. This one is dedicated to the Oracle Forms product.
    Francois

  • Facelets Portlet?

    I know that you can't possibly support a new type of portlet this late in the game, so I'd like to make a suggestion for a future release. :) We're looking very closely at the Facelets view technology for JSF. It doesn't use JSPs to render the view, and buys us the ability to build composition components quickly and easily. (so we get to leverage the main benefit from JSF - reusable components) Assuming we can get Myfaces 1.1.x to work on 9.2 (which I haven't tried yet) I should in theory be able to use it. Was wondering if this technology was on your roadmap and if there were any thoughts about 'enabling' customers to use it with the JSF Portlets is we chose to. The main issue I see with it at first is that it only runs on MyFaces 1.1.x codeline or the Sun JSF-1.2 RI (which isn't final yet). Seems to me that Facelets + Portlets would be the ideal (and most productive) Portal dev environment. Plus, throw in Page Flows and... ;)

    Hi,
    Thanks again for looking at the WLP 9.2 Tech Preview. We appreciate your support and your suggestion. We will add your request to our list.
    One quick question, did you try running the Facelets with our JSF portlet? What do you get?
    Regards,
    --alex                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Why composite component doesn't see action command?

    Using JSF2, facelets, glassfish 3.
    I have a composite component that doesn't seem to be able to identify the action parameter for a button.
    I get an error in the server log that says:
    javax.faces.FacesException: javax.el.PropertyNotFoundException: /resources/components/financial/payrollRight.xhtml @21,85 goBtnAction="#{payrollSessionBean.goBtn_action}": The class 'principlenet.PayrollSessionBean_$$_javassist_170' does not have the property 'goBtn_action'.
    Does anyone know what I am doing wrong, that I can't see the action property?
    This was originally a PrimeFaces command button, but I get the same results if I change back to an h:commandButton.
    I'm relatively new to JSF2 and composite components, so I don't know if I am not creating the component properly or what.
    Thanks.
    Here is the 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:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:enc="http://java.sun.com/jsf/composite/components/enrollment/common"
          xmlns:cc="http://java.sun.com/jsf/composite"
          xmlns:p="http://primefaces.prime.com.tr/ui"
          xmlns:comp="http://java.sun.com/jsf/composite/components">
        <!-- INTERFACE -->
        <cc:interface>
            <cc:attribute name="styleClass" default="selectDatePanel" required="false"/>
            <cc:attribute name="rendered" default="true" required="false"/>
            <cc:attribute name="calStyleClass" default="" required="false" />
            <cc:attribute name="descStyleClass" default="selectDateDesc" required="false" />
            <cc:attribute name="descValue" default="Select Date:" required="false" />
            <cc:attribute name="calInputStyleClass" default="selectDateInput" required="false" />
            <cc:attribute name="inputValue" default="" required="false" />
            <cc:attribute name="calImageStyleClass" default="selectDateCal" required="false" />
            <cc:attribute name="toolTip" default="Enter date or push calendar icon and select date.  Then push 'Go'." required="false" />
            <cc:attribute name="goBtnStyleClass" default="selectDateGoBtn" required="false" />
            <cc:attribute name="goBtnValue" default="Go" required="false" />
            <cc:attribute name="goBtnAction" default="" required="false" />
            <cc:attribute name="update" default="" required="false" />
        </cc:interface>
        <!-- IMPLEMENTATION -->
        <cc:implementation>
            <p:outputPanel id="selectDatePanel" styleClass="#{cc.attrs.styleClass}" rendered="#{cc.attrs.rendered}" >
                <enc:calendarGroup id="selectDate"
                                   styleClass="#{cc.attrs.calStyleClass}"
                                   descStyleClass="#{cc.attrs.descStyleClass}"
                                   descValue="#{cc.attrs.descValue}"
                                   calInputStyleClass="#{cc.attrs.calInputStyleClass}"
                                   inputValue="#{cc.attrs.inputValue}"
                                   calImageStyleClass="#{cc.attrs.calImageStyleClass}"
                                   toolTip="#{cc.attrs.toolTip}" />
                <h:commandButton id="selectDateGoBtn" styleClass="#{cc.attrs.goBtnStyleClass}"
                                 value="#{cc.attrs.goBtnValue}"
                                 action="#{cc.attrs.goBtnAction}" />
            </p:outputPanel>
        </cc:implementation>
    </html>Here is a portion of the page that calls the 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:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:tsc="http://java.sun.com/jsf/composite/components/timesheet"
          xmlns:cc="http://java.sun.com/jsf/composite"
          xmlns:p="http://primefaces.prime.com.tr/ui"
          xmlns:comp="http://java.sun.com/jsf/composite/components">
        <!-- INTERFACE -->
        <cc:interface>
        </cc:interface>
        <!-- IMPLEMENTATION -->
        <cc:implementation>
            <p:outputPanel id="payrollRightPnl" styleClass="rightPanel" >
                <h:form id="payrollRightForm" styleClass="rightPanel" prependId="false" >
                    <comp:selectDate id="prSelectDate" styleClass="prSelectDate"
                                     inputValue="#{loginSessionBean.selectedDate}"
                                     goBtnAction="#{payrollSessionBean.goBtn_action}" />Here is the goBtn_action() method of the backing bean:
        public void goBtn_action() {
            lsb.logMsg("<PayrollSessionBean.goBtn_action>");
            setReadPayrollData(true);
            drawPayrollGrid();
        }

    Hello!! I wanted to tell you that I tested with "method-signature" but I have also worked continuously showing the same error.
    Excepcion
    javax.servlet.ServletException: javax.el.PropertyNotFoundException: Objetivo inalcanzable, identificador 'swithPagesBean' resuelto a nulo
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:321)
    org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
    causa raíz
    javax.faces.el.EvaluationException: javax.el.PropertyNotFoundException: Objetivo inalcanzable, identificador 'swithPagesBean' resuelto a nulo
    javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:91)
    com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:98)
    javax.faces.component.UICommand.broadcast(UICommand.java:311)
    javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:781)
    javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1246)
    com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:77)
    com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
    com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
    org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
    My code is:
    BACKING BEAN : "SwithPagesBean" ----------------------------------------------------
    public class SwithPagesBean implements Serializable {
    private String home = "home";
    private String newUserPage = "new_user";
    private String modifiUserPage = "modifi_user";
    //*Getteres,Setter & constructor *//
    //This is the first page to run
    FILE: "HOME.XHTML" ---------------------------------------------------------------
    <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">
    <f:view>
    <h:head>
    </h:head>
    <h:body>
    <h:form>
    <ui:composition template="template_home.xhtml">
    <ui:define name="footer">
    <h:form>
    <h1>Estas en el home</h1>
    </h:form>
    </ui:define>
    </ui:composition>
    </h:form>
    </h:body>
    </f:view>
    </html>
    FILE: TEMPLATE_HOME.XHTML -----------------------------------------------------------------------------
    <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:p="http://primefaces.prime.com.tr/ui"
    xmlns:ui="http://java.sun.com/jsf/facelets">
    <f:view>
    <h:head>
    </h:head>
    <h:body>
    <div id="layout_intellipost">
    <div id="header">
    <ui:include src="header.xhtml" />
    </div>
    <div>
    <ui:insert name="footer">
    </ui:insert>
    </div>
    </div>
    </h:body>
    </f:view>
    </html>
    FILE: "HEADER.XHTML"-------------------------------------------------------------------------------------------
    <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:p="http://primefaces.prime.com.tr/ui"
    xmlns:gfu="http://java.sun.com/jsf/composite/gfu">
    <f:view>
    <ui:composition>
    <h:form>
    <p:panel id="panel" header="IntelliPos - Caja 66" >
    <h:panelGrid columns="6">
    <gfu:Navegator action="#{swithPagesBean.newUserPage}" btnModificacionLabel="Modificar Usuario" />
    </h:panelGrid>
    </p:panel>
    </h:form>
    </ui:composition>
    </f:view>
    </html>
    FILE: "NAVEGATOR" ---------------------------------------------------------------------------------------------------------------
    <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:p="http://primefaces.prime.com.tr/ui"
    xmlns:composite="http://java.sun.com/jsf/composite">
    <f:view>
    <head>
    <title>Navegator Alta</title>
    </head>
    <body>
    <composite:interface>
    <composite:attribute name="btnModificacionLabel" />
    <composite:actionSource name="btnModificacion" />
    <composite:attribute name="action" method-signature="java.lang.String f()" targets="btnModificacion" />
    </composite:interface>
    <composite:implementation>
    <h:commandButton id="btnModificacion" value="#{cc.attrs.btnModificacionLabel}"/>
    </composite:implementation>
    </body>
    </f:view>
    </html>
    file: "faces-config"
    <navigation-rule>
    <navigation-case>
    <from-outcome>new_user</from-outcome>
    <to-view-id>/facelet/alta.xhtml</to-view-id>
    </navigation-case>
    </navigation-rule>
    When y try to click in my custom command button "navegator", this is to fire the excepcion mentioned.
    Anyone have any other suggestions?
    From already thank you very much!

  • Recursive Loop Error while doing standard cost estimate

    SAP Gurus,
    We are trying to do standard cost estimate on a material and we are getting error because it is going in recursive loop even though we have used "recursive allowed" indicator for item components in the BOM. The error message numbers are CK 730 and CK 740. We are using 4.6c. I have tried the same scenario in ECC 6.0 and still I get the same problem.
    Below is my BOM structure:
    Material 10890345 (has low-level code 012)
            ---> 10867220 (has low-level code 013) and has recursive allowed indicator
    10867220
            ---> 10846733  (has low-level code 014) and has recursive allowed indicator
    10846733
            ---> 10890345 (has low-level code 012) and has recursive allowed indicator
    According to me, the BOM for material 10846733 is causing the problem.
    For some weird reason while doing the costing run for material 10890345, it s not stopping and going in a loop.10890345  and 10846733 should ideally have the same low-level code as they are recursive.
    Please help to provide some solutions at the earliest on how to avoid recursive loop during costing.
    Regards,
    Swapnil

    Dear,
    I have 2 things to shear with you.
    The method we followed to solve the iteration is as below
    1.Config change -
    Valuation variant in the costing variant, we changed the sequence as below
    material valuation
    4 planned price 1
    2 std price
    3 Mov ave price
    2. Material master change
    made all the semi finished goods and finished goods
    procurement type = E,
    costing with qty structure,
    Enter the planned price1
    By doing this what happens is
    when system first start the iteration, takes the planned price 1 and start iterating and next time in the second iteration it takes the calculated price from qty structure till it finds the difference between the value calculated is less than .001. Then it gives the result
    Why lot size is important is, in our case in some levels the usage is very less compared to the first material header qty and system used to stop in between  and not even reaching the last level as during the cycle it was reaching less .001 difference. may be in your case it may not be the case...just check
    Please come back after trying this. this was the only last option i had to solve the issue in my client.
    Another alternative is to have a different material for costing purpose to stop the iteration which i will not recommend as we need to do some calculation for each stage and input the cost of dummy material in each stage.
    My client is happy with the result as the difference between manual calculation and system calculation is less then .1%...this is because SAP will not consider the difference beyond .001, but in excel you get as many as decimals you want.

  • Best practice for JSF 2.0 composite component?

    Following the various tutorials and blog entries I have found, I have managed to implement a few composite components. I want to do a more complex one, but haven't found and example yet to follow and my own proficiency in programming model isn't sufficient for me to determine the best way to do it.
    What I would want to implement is something like the following example.
    .. xmlns:mc="http://java.syn.com/jsf/composite/myComponent" ..
    <mc:addTwo value="#{SomeBean.someProperty}" />The included component has two fields, which when the user inputs those the someProperty is set to some calculation of those two (for example adding them together). What I think I need to do is implement a backing bean for the "addTwo" component and do the calculation there. Then when that is done the composite backing bean needs to access the using page's SomeBean.someProperty setter. How is this done?
    My actual intent is to make a component that looks up an entity in a data base based on a number of user inputs, then set the "someProperty" property to that value. If I could do the above example then I think I can apply the same principle, which is to have the composite component's backing bean access the someProperty property in the using page's bean via a #{cc.attrs.xxx} type reference. Am I on the right track?

    this certainly seems like the place for JSF 2.0 discussions, yes.
    It seems so obvious, was this forum called something else when this was posted perhaps?

Maybe you are looking for

  • Cash or bank account should not go below zero

    hi friends, what are configuration required to set bank and cash account should not go below zero. and system should give an error message for the same.

  • Printing from javascript

    i want to devolop a site on that there should be facility for printing and downloading files. what are the requirements in javascript

  • Standard Username an Password for the new Release2 As Portal?

    i have installed the Applicationserver Release2 with Portal , but i can not access to the Portal with the Standard Username and Password , i need the new Standard username and Password for the new Oracle Portal(Release2) the same Problem is with the

  • Unable to see database in Grid Control

    I installed Grid Control 10g and started both OMS service and agent. I also installed another agent on a different host. When I run macux3:1830/emd/main (this is where I installed the Grid Control) and macux4:1830/emd/main (this is where my productio

  • How to drop multiple tables in SQL Workshop

    Hi, I'd like to drop multiple tables in one time but SQL command processor returnes error message: ORA-00933. Could you please tell me how to drop multiple tables in one time? My trial was follows Drop table "table1", "table2" Result ORA-00933: SQL c