I don't think it is possible to "split" a form across multiple Tiles because the Tile is a complete (translated) response. A form must be complete on a Tile.

However, you can achieve the desired behavior by using the JSP include directive -- the included fragment will can be a portion of the form; it will be included as part of the translation phase; prior to compilation of your JSP.

-Bill Siggelkow

Graeme Miller wrote:
Simple question with no helpful responses so far.

I must therefore conclude either a)Noone uses tiles because they are broken
b)Noone understands tiles
c)The way I am proposing to use tiles is so dramatically wrong at a
design level that noone has a clue what I am asking.


Just as a quick summary if I have a html:form tag that wraps two tiles
and put a html control in one of the tiles that requires a html:form tag
(such as html:checkbox, html:text etc) I get an error saying that could
not find the form (see message below).  How do I make it so that the
html:form tag is scoped across both tiles as I want to be able to put
controls in one tile and buttons to submit in another?

Please don't make post a bug on the Struts bugzilla just to get an
answer.  Without some "words from the wise" I don't see how its behaving
in a correct manner.

Thanks,

Graeme.

-----Original Message-----
From: Graeme Miller [mailto:[EMAIL PROTECTED] Sent: Tuesday, 30 November 2004 3:16 p.m.
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]


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



Reply via email to