aspose file tools*
The moose likes Struts and the fly likes forms and tiles Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "forms and tiles" Watch "forms and tiles" New topic
Author

forms and tiles

Tad Dicks
Ranch Hand

Joined: Nov 16, 2004
Posts: 264
Is it possible to include multiple tiles inside of a form?

I have two similiar forms, and would like to avoid repeating the same elements.
Is it possible to put all of the identical elements inside of a tile and then include this tile inside each form?

-Tad
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

It is possible.

The only catch is that the <html: tags must include the "name" attribute. The problem there is that the your forms probably have different names.


A good workman is known by his tools.
Tad Dicks
Ranch Hand

Joined: Nov 16, 2004
Posts: 264
so inside each separate tile(jsp fragment/document). I need to have the
tag? <html:form
I can't have
<html:form action="xxx">
.
.
.
<tile:insert definition="sharedFormElments"/>
.
.
.
</html:form>
in one document.

And then this in another(sharedFormElements)?
.
.
<html:text property="xy"/>
.
.


or should I use a jsp include tag? or?

-Tad
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4419
    
    5

Originally posted by Tad Dicks:
so inside each separate tile(jsp fragment/document). I need to have the
tag? <html:form
I can't have
<html:form action="xxx">
.
.
.
<tile:insert definition="sharedFormElments"/>
.
.
.
</html:form>
in one document.

And then this in another(sharedFormElements)?
.
.
<html:text property="xy"/>
.
.


or should I use a jsp include tag? or?

-Tad


Using the JSP include tag will only help if you use a static resource, i.e. something doesn't have a ".JSP" extension. Resources that are dynamically included will be translated as a separate servlet. It's just like making a call to a method in a different class. I'm not even sure if specifying the "name" attribute will help since the struts documentation states that most of the html tags need to be nested in a html form tag.

A static include, on the other hand, is translated "in place" just as if you were copying and pasting the included code into your JSP. I usually use an ".inc" extension instead of ".jsp" for files I want to include statically.


Junilu - [How to Ask Questions] [How to Answer Questions]
Naina Si
Ranch Hand

Joined: Nov 05, 2003
Posts: 134
Can someone give me a detailed reply on where else we can use tiles and the advantages of it..
Larry Johnson
Greenhorn

Joined: Jan 13, 2005
Posts: 4
i'm not quite sure what you are asking but you shoudl be able to do this:

1st page


2nd page
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: forms and tiles
 
Similar Threads
Turning a form-property into a bean on a JSP
Inserting tiles dynamically.
Values in multiple tiles
Struts + Tiles + Form
struts validator and tiles