-----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