Now I see what you mean. What 'push' does is to put a value on top of
the stack. The name attribute is a string, not an expression, and
doesn't use the stack for anything. That is why it wouldn't work.
There is a simple workaround tho,

you can set a variable for it like:

<s:set var="prefix" value="%{''person'}" />
.....
<s:textfield name="%{#prefix + '.x.y.z'}" />
....
 or even
<s:textfield name="%{#prefix}.x.y.z'}" />

I dont remember if the second option works.


musachy

On Thu, Dec 11, 2008 at 5:08 PM, Andreas Joseph Krogh
<andr...@officenet.no> wrote:
> On Thursday 11 December 2008 22:52:06 Musachy Barroso wrote:
>> > Have you ever used the nested-tags in Struts-1.1?
>>
>> Just for a few months to add it to my resume :)
>
> I've been depending on the nested-tags for years:-)
>
>> > 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".
>>
>> I understand, but I still don't get why the push tag is not enough.
>
> What I don't understand is why the push-tag isn't enough either:-) The point 
> is that the push-tag only makes the value of the input-tags corrent, not the 
> "name"-attribute. Why it's designed that way I don't know, but that's what 
> I'm suggesting to change.
> Go ahead and try it and you'll quickly see what I mean.
>
> Take this example here:
> http://struts.apache.org/2.1.2/docs/struts-2-spring-2-jpa-ajax.html
> In index.jsp it has:
>        <div style="width: 300px;border-style: solid">
>                        <p>Person Data</p>
>                        <s:form action="save" validate="true">
>                                <s:textfield id="id" name="person.id" 
> cssStyle="display:none"/>
>                                        <s:textfield id="firstName" 
> label="First Name" name="person.firstName"/>
>                                        <s:textfield id="lastName" label="Last 
> Name" name="person.lastName"/>
>                                        <s:submit theme="ajax" 
> targets="persons" notifyTopics="/save"/>
>                        </s:form>
>        </div>
>
> And I propose changing it so that you can write this insted:
>
>        <div style="width: 300px;border-style: solid">
>                        <p>Person Data</p>
>                        <s:form action="save" validate="true">
>                                <s:push value="person">
>                                <s:textfield id="id" name="id" 
> cssStyle="display:none"/>
>                                        <s:textfield id="firstName" 
> label="First Name" name="firstName"/>
>                                        <s:textfield id="lastName" label="Last 
> Name" name="lastName"/>
>                                        <s:submit theme="ajax" 
> targets="persons" notifyTopics="/save"/>
>                                </s:push>
>                        </s:form>
>        </div>
>
> Notice how the "person." part is missing from the input-tags.
>
> --
> Andreas Joseph Krogh <andr...@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-unsubscr...@struts.apache.org
> For additional commands, e-mail: dev-h...@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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

Reply via email to