Thanks Laurie,

I actually thought of a tag file but thought it might be the lazy way out.
We actually use them extensively for dropping in html components.

I feel a lot better now.

Thanks

Z.
> 
> Zoran Avtarovski wrote:
>> > Hi,
>> > 
>> > We porting/upgrading a relatively simple survey tool over to struts2 from
>> an
>> > old php version.
>> > 
>> > The tool manages questions which can one of a fixed type (radio, drop,
>> > checkbox, text) and then persists responses to DB.
>> > Where I need some advice is how to implement the struts 2 display
>> mechanism..
>> > 
>> > I figure there are two options:
>> > 
>> > 1. Write a custom tag which takes the question as an attribute. Something
>> > like <s:question value=²%{question}² />
> 
> Well, it wouldn't be s:question unless you're planning on modifying the
> Struts taglib ;=) but a custom tag would be one way to do this. Using a
> .tag file might be the easiest, depending how complex your rendering
> logic is.
> 
>> > 2. I could have a small jsp fragment that I would include to render the
>> > appropriate html.
>> > 
>> > I figured I¹d do something like :
>> > 
>> > <s:iterator value=²questions² id=²question²>
>> > <s:push value=²%{question}²>
>> >     <s:include value=²pagefragment.jspf²/>
>> > </s:push>
>> > </s:iterator>
> 
> The tag-based solution is obviously more concise to use, although the
> s:push is unnecessary here (s:iterator pushes the value automatically).
> 
>> > And pagefragment.jspf would have some logic and use the appropriate form
>> > tags to render the HTML.
> 
> If you can express what you want to do in a JSP, it should be trivial to
> do it in a .tag file, which would give you the more concise usage.
> Otherwise, a custom tag may be worth it.
> 
> L.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


Reply via email to