Subject: Display Tag? (2.0.11) 2007-11-01 - By Jake Robb
Back I've used DisplayTag with S1 before, with excellent results. I'm also using it in S2 in a few cases, and it's working fine.
However, now I want to use it to render a form. Each row in the table will contain a couple of input tags, and the table as a whole represents a single List on my action.
Without DisplayTag, I can accomplish that as follows:
<s:iterator value="rules" status="status" id="rule"> <div class="resultRow${status.odd ? ' highlight' : ''}"> <div class="name"> <s:property value="name" /> </div> <div class="value"> <s:textfield name="%{'rules['+#status.index+'].value'}" label="" size="90" /> </div> </div> </s:iterator>
I converted the code above as follows:
<display:table htmlId="rulesTable" list="rules" id="rule"> <display:column title="Rule Name"> <s:property value="name" /> </display:column> <display:column title="Rule Name"> <s:textfield name="rules[rule_rowNum].value" label="" size="90" /> </display:column> </display:table>
But that didn't work, because DisplayTag doesn't push rule_rowNum onto the stack. So I added a push tag:
<display:table htmlId="rulesTable" list="rules" id="rule"> <s:push value="<%= rule_rowNum.toString() %>" id="rowNum"/> <display:column title="Rule Name"> <s:property value="name" /> </display:column> <display:column title="Rule Name"> <s:textfield name="rules[rowNum].value" size="90" /> </display:column> </display:table>
Then I discovered that s:push doesn't accept runtime expressions, just like everything else in 2.0.11.
So, how do I accomplish this? I guess I could keep it the old way, but I'd really rather be consistent.
-Jake
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ To unsubscribe, e-mail: user-unsubscribe@(protected) For additional commands, e-mail: user-help@(protected)
|
|