You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Kevin Cramer <kc...@siscom.net> on 2003/04/11 16:33:12 UTC

Tile attributes in HTML tags

I want to use a tile attribute from a definition in my
tiles-defs.xml in one of the Struts HTML tags.  It seems like I should
be able to do it, but I cannot get it working.

I know the usual suggestion here is to use struts-el but I'm stuck
deploying to a WebSphere 4.0 server and it doesn't have new enough
Servlet and JSP to use JSTL.

Here's a snippet from what I am trying to do:

<tiles:importAttribute name="helpContext"/>

<html:rewrite page="/help.do" anchor="<%= helpContext %>"/>

What is the proper way to do what I have above?  It doesn't work plus
I don't feel it's right to have that JSP expression in the JSP.  I'm
trying to stick to tags and regular HTML.  I think this question
applies to any dynamic value you want to put into an attribute of a
Struts tag.  The docs say that anchor is an RT EXPR so I should be
able to set it at runtime but I've had no luck with any syntax I can
think of.

Thanks,
Kevin

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


Re: Tile attributes in HTML tags

Posted by Nicolas De Loof <ni...@cgey.com>.
You're in the good way, just add a bean:define to define the scriptlet variable:

> Here's a snippet from what I am trying to do:
> 
> <tiles:importAttribute name="helpContext"/>


<bean:define id="helpContext " name="helpContext" />

> 
> <html:rewrite page="/help.do" anchor="<%= helpContext %>"/>
> 


> I don't feel it's right to have that JSP expression in the JSP.  I'm
> trying to stick to tags and regular HTML.  I think this question

Using JSP expression as tags attributes is not a bad design, using JSP scriptlets
is.

Nico.


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