You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Roger Varley <ro...@googlemail.com> on 2007/02/28 14:12:34 UTC

Using Struts Tag to create HTML tag

Hi

I'm using the <s:iterator> tag with the status attribute to get the
iterator count. From this I want to dynamically construct an HTML tag
<div class="columnX"/> where X is the value of the iterator status
count. Can I actually do this and if so, how or do I need to provide
this information from my action class

Regards
Roger

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


Re: [S2] Using Struts Tag to create HTML tag

Posted by Tim Azzopardi <ti...@tigerfive.com>.
This works for me: set a request scope variabe with s:set and then use a jstl
expression like ${zi}
You should be able to use ${zi} pretty much anywhere.
Don't know if there is a more strutsy way of doing it but it works for me.


e.g.

<s:iterator value="collectionOnAction" status="status">

	<tr>
		<s:set name="zi" value="#status.index" scope="request"/>

		<s:textfield name="collectionOnAction[${zi}].internalComments"
id="prLines${zi}.internalComments"value="%{internalComments}" />
	</tr>
</s:iterator>



Roger Varley wrote:
> 
> Hi
> 
> I'm using the <s:iterator> tag with the status attribute to get the
> iterator count. From this I want to dynamically construct an HTML tag
> <div class="columnX"/> where X is the value of the iterator status
> count. Can I actually do this and if so, how or do I need to provide
> this information from my action class
> 
> Regards
> Roger
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Using-Struts-Tag-to-create-HTML-tag-tf3308740.html#a9204512
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Using Struts Tag to create HTML tag

Posted by Roger Varley <ro...@googlemail.com>.
>
> Either use JSTL as previous poster mentioned or use
> the <s:property.../> tag to create the div name.
>

Actually after replying to your previous e-mail I had that doh! moment and tried
<div class="col<s:property value="#status.count"/>"> which worked.
This, for some reason surprised me that it worked, but I'm getting
this sensation with quite a lot of Struts2 as I get into it :-)

Regards
Roger

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


Re: Using Struts Tag to create HTML tag

Posted by Dave Newton <ne...@yahoo.com>.
--- Roger Varley wrote:
> On 28/02/07, Dave Newton wrote:
> > See the bottom of
> >
> > http://cwiki.apache.org/WW/iterator.html
> I think I must be having a particularly dense day
> today, but I can't see anything there that helps.

Either use JSTL as previous poster mentioned or use
the <s:property.../> tag to create the div name.

d.



 
____________________________________________________________________________________
Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.
http://videogames.yahoo.com/platform?platform=120121

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


Re: Using Struts Tag to create HTML tag

Posted by Roger Varley <ro...@googlemail.com>.
On 28/02/07, Dave Newton <ne...@yahoo.com> wrote:
> --- Roger Varley <ro...@googlemail.com> wrote:
> > I'm using the <s:iterator> tag with the status
> > attribute to get the iterator count. From this I
> want
> > to dynamically construct an HTML tag <div
> > class="columnX"/> where X is the value of the
> > iterator status count. Can I actually do this and if
>
> > so, how or do I need to provide this information
> from
> > my action class
>
> See the bottom of
>
> http://cwiki.apache.org/WW/iterator.html
>

I think I must be having a particularly dense day today, but I can't
see anything there that helps.

Regards
Roger

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


Re: Using Struts Tag to create HTML tag

Posted by Dave Newton <ne...@yahoo.com>.
--- Roger Varley <ro...@googlemail.com> wrote:
> I'm using the <s:iterator> tag with the status
> attribute to get the iterator count. From this I
want
> to dynamically construct an HTML tag <div 
> class="columnX"/> where X is the value of the
> iterator status count. Can I actually do this and if

> so, how or do I need to provide this information
from
> my action class

See the bottom of

http://cwiki.apache.org/WW/iterator.html

d.



 
____________________________________________________________________________________
Sucker-punch spam with award-winning protection. 
Try the free Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/features_spam.html

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