On 12/1/06 3:21 AM, "Don Brown" <[EMAIL PROTECTED]> wrote:
>
> On 8/30/06, Mark Menard <[EMAIL PROTECTED]> wrote:
>> Is this following possible?
>> 
>> <s:bean name="java.util.HashMap" id="qTableLayout">
>> </s:bean>
>> <s:push value="#qTableLayout">
>>     <s:param name="tablecolspan" value="%{4}" />
>>     <s:param name="currentColumnCount" value="%{0}" />
>> </s:push>
>> 
>> 
>> If it isn't how do you change the value of something on the value stack once
>> you are either into a JSP or in a FreeMarker template?
>
> Why do you need to modify?  What about just pushing something else
> that effectively overrides the existing value?

Don,

Wow! You went back quite a ways to find this issue.

I guess I could have done that. It didn't seem obvious to me at the time,
nor does it seem efficient, creating a Map for one invocation of a
FreeMarker template and then just throwing it away, when just updating a
property within the Map would do.

Background. I was working on a theme that would automatically handle
multi-column layout of forms. I used the qTableLayout Map to hold my
configuration, tablecolspan, and the current state of the table,
currentColumnCount. I needed to be able to modify currentColumnCount from
within my FreeMarker templates, so the various templates would know if they
needed to emit either an open <tr> or a close </tr>.

My issue when I wrote that email was I couldn't figure out how to update the
currentColumnCount insided the qTableLayout Map. tm_jee on the WW forum
pointed out that I could do the following in my FreeMarker template:

    ${stack.setValue('#qTableLayout.currentColumnCount', columnCount)}

To a complete beginner this wasn't obvious. I was struggling with the fact
that FreeMarker couldn't change the "model". So, I figured there would be a
way to do that using the WW/S2 tags, which I couldn't figure out. The thread
on the WW forum is:

    http://forums.opensymphony.com/thread.jspa?messageID=83553

If there is a tag equivalent of stack.setValue ("#someMap.someProperty",
value) I'd be curious.

You can see an example of what I got working at:

    http://www.vitarara.org/cms/node/74

Don't take the commentary in there to seriously I was very tired and cranky
at the time. This functionality seemed so obviously needed on its face to
me, but I just couldn't figure out how to make it work. Anyway, it works
today, and it's a lot more sophisticated. I have support for variable label
and input column spans. I might also work in variable row span support if I
find I need it. I'm currently working on a tutorial covering what I did.
I'll post the link when I get done.

Thanks,

Mark

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

Reply via email to