Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

forms and tiles

 
Tad Dicks
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Tad Dicks
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7483
50
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Naina Si
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone give me a detailed reply on where else we can use tiles and the advantages of it..
 
Larry Johnson
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm not quite sure what you are asking but you shoudl be able to do this:

1st page


2nd page
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic