Graeme, 

What is the attributes of your form (formAction)? Do you have a
getter/setter for "delete"? I believe that this what '<html:checkbox
property="delete">' is looking for. 

Shed. 
-----Original Message-----
From: Graeme Miller [mailto:[EMAIL PROTECTED]
Sent: Monday, November 29, 2004 21:16
To: [EMAIL PROTECTED]
Subject: Tiles and Forms


What is the correct pattern for placing a struts html:form tag in a
layout where 
- the controls may be in a different location (and hence different
tiles) from the buttons that submit the form
- where you want the action the form submits to to be customisable by
whatever jsp uses this form?

If anyone could give a simple example of using this pattern I would
appreciate it.

For example here's a simplification of what I am currently trying

Simple Layout

<%@ page language="java"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html";
prefix="html"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles";
prefix="tiles"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean";
prefix="bean"%>
<html:html locale="true">
  <head>
    <title><tiles:getAsString name="title"/></title>
  </head>
  <body>
    <bean:define id="formAction"
type="java.lang.String"><tiles:getAsString
name="formAction"/></bean:define>
    <html:form action="<%= formAction %>">              
    <tiles:insert attribute="body"/>
    <tiles:insert attribute="buttons"/>
    </html:form>
  </body>
</html:html>

Simple Use of the above layout (using the body wrap pattern for ease of
readability)

<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles";
prefix="tiles"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html";
prefix="html"%>
<tiles:insert page="simple-layout.jsp" flush="true">
  <tiles:put name="title" value="Hello World" />
  <tiles:put name="formAction" value="/SomeAction.do" />
  <tiles:put name="body" type="string"><html:checkbox
property="delete"></tiles:put>
  <tiles:put name="buttons" type="string"><html:submit
property="command">Save</html:submit></tiles:put>
</tiles:insert>

Unfortunately while the form action gets correctly rendered with the
right action passed from the jsp that uses the layout, the checkbox
rendering fails with the message "Cannot find bean
org.apache.struts.taglib.html.BEAN in any scope".  As far as I
understand this means the html form tag is not being put in scope for
the checkbox to find. 

Any wise words appreciated.

Graeme 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to