Thanks for the advice David.

 

I have tried the f:view / h:form on main page inside the ui:composition tag and outside the ui:composition tag and I basically get the same error that the command buttons must be inside an h:form.

 

I have tried using an ui:insert on the main page with the same issue that the command buttons must be inside a h:form.

 

Have you successfully placed command buttons inside a layout on any of the facelets work you have done? 

 

Meanwhile I have printed out the documentation and will try some of the other things you have suggested. Hopefully something will eventually work!!!!

 

Tom

 

 

 

-----Original Message-----
From: David Friedman [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 19, 2006 12:52 PM
To: MyFaces Discussion
Subject: RE: Facelets Layout / Command Button Issue

 

Tom,

 

I think you need to review the Facelets Guidebook: https://facelets.dev.java.net/nonav/docs/dev/docbook.html#template-composition

 

ui:composition removes everything from the page except for what is inside your tags.  That means you LOST your f:view and h:form tags and that seems to match your posted errors.  I recommend your main page use a different tag such as ui:decorate, ui:insert, or ui:fragment (not reallly recommended because you must create a binding name).

 

Also, you should keep requests like this on the facelets list (I know you subscribe to both, I've seen your postings) and just have patience if you want help.  Or review the documentation slowly and find the nicely documented "quirks" or each taglib.  Again, the Facelets docbook is an excellent guide to  print out and keep by your desk.  I did when I first started with Facelets. See you on the facelets list!

 

Regards,

David

-----Original Message-----
From: Tom Innes [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 19, 2006 11:48 AM
To: 'MyFaces Discussion'
Subject: Facelets Layout / Command Button Issue

I apologize, if this is the correct group for my question. 

 

I am trying to create a facelets layout hierarchy for a crud based application I am building in JSF.  I have a proto type working fine in JSF and now I want to use facelets to standardize the layouts before we begin the actual application.  I have created a base layout that defines things like message blocks and such.  I would like to create a QBE layout that includes my base layout and a button panel that has buttons like find, clear, etc. 

 

The problem is that I am unable to place a h:commandbuttom inside the layout.  For Instance

 

 

aQBEButtonPanel.xhtml

<html xmlns="http://www.w3.org/1999/xhtml"

      xmlns:ui="http://java.sun.com/jsf/facelets"

      xmlns:h="http://java.sun.com/jsf/html">

      <ui:composition>

                 <h:panelGrid rows="3" columns="1">

                        <h:commandButton value="Find" action="" id="findButton"/>

                        <h:commandButton value="Clear" action="" id="clearButton"  immediate="true"/>

                        <h:commandButton value="Add" action="" id="addButton"  immediate="true"/>

                 </h:panelGrid>

      </ui:composition>

</html>

 

I have a base Layout defined as

 

aBaseLayout.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:ui="http://java.sun.com/jsf/facelets"

      xmlns:h="http://java.sun.com/jsf/html">

      <head>

        <title>#{title}</title>

        <link rel="stylesheet" type="text/css" href="" />

      </head>

      <body>

            <div id="qbe-buttons">

                <ui:include src="">

            </div>           

            <div id="center">

              <ui:insert name="content">

                 <div>

                  <ui:include src=""

                </div>

              </ui:insert>

            </div>

      </body>

</html>

 

 

And the countryQBE.xhtml is defined 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:ui="http://java.sun.com/jsf/facelets"

      xmlns:h="http://java.sun.com/jsf/html"

      xmlns:f="http://java.sun.com/jsf/core"

      xmlns:t="http://myfaces.apache.org/tomahawk"

      xmlns:as="http://com.alltiers.client.jsf/allTierSystems">

     

<f:view>

      <h:form id="countryQBEForm">

            <body>

                  <ui:composition template="/facelets/layout/aBaseLayout.xhtml">

                        <ui:param name="title" value="#{countryQBEController.title}"/>

                        <ui:param name="theQBEController" value="#{countryQBEController}"/>

                        <ui:param name="theFormController" value="#{countryFormController}"/>

                        <ui:define name="content">

                              <h:panelGrid columns="3">

                                                            Bunch of Input Fields

                                                           

                                                            Etc

 

The problem is that I get this exception

23:11:04,062 INFO  [STDOUT] 6-Jun-2006 11:11:04 PM com.sun.facelets.FaceletViewHandler handleRenderException

SEVERE: Error Rendering View[/pages/countryQBE.xhtml]

java.lang.IllegalArgumentException: Component findButton must be embedded in an form

      at org.apache.myfaces.shared_impl.renderkit.html.HtmlButtonRendererBase.buildOnClick(Htm

 

 

Now the commandButtons cannot be contained in a different Form than the Input Fields otherwise the Model is not updated.  Does anybody know how to place a command button in a facelets layout?

 

Tom

                                                           

 

Reply via email to