struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Joseph Krogh <andr...@officenet.no>
Subject Re: Nested-tag support
Date Thu, 11 Dec 2008 21:47:05 GMT
On Thursday 11 December 2008 22:36:37 Musachy Barroso wrote:
> I am sort if confused here, what are the advantages of this?

Have you ever used the nested-tags in Struts-1.1?
The advantage is that the value of the "name"-attribute is calculated for you.

That way you can write:
       <s:form name="myForm">
         <s:push value="person.address">
               <s:textfield name="street"/>
         </s:push>
       </s:form>
Notice the inner s:textfield is only specifying name="street" which is enough to render name="person.address.street"
because it knows it's inside the address-object (s:push).

This example is rather simple, but in much more complicated forms, inside iterators for example,
where you want to reuse JSPs it is *extremely* useful to avoid code-douplication. Much easier
to generate dynamic user-interfaces this way. The philosophy is "as long as I'm inside this
nested-context I know I can render this piece of code regardless of the object-hierarchy the
object resides in".


-- 
Andreas Joseph Krogh <andreak@officenet.no>
Senior Software Developer / CEO
------------------------+---------------------------------------------+
OfficeNet AS            | The most difficult thing in the world is to |
Karenslyst Allé 11      | know how to do a thing and to watch         |
PO. Box 529 Skøyen      | somebody else doing it wrong, without       |
0214 Oslo               | comment.                                    |
NORWAY                  |                                             |
Tlf:    +47 24 15 38 90 |                                             |
Fax:    +47 24 15 38 91 |                                             |
Mobile: +47 909  56 963 |                                             |
------------------------+---------------------------------------------+

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Mime
View raw message