Wes:

I changed my code to this:

<[EMAIL PROTECTED] prefix="s" uri="/struts-tags"%>

<% 
String label = "Address";
if( request.getAttribute("requireFullAddress") != null )
        label += "*";
request.setAttribute("label",label);
%>
<s:textfield label="%{label}" name="address.line1" />

I still get an empty label.

Any ideas why this did not work?

Thanks,
        Neil

--
Neil Aggarwal, (832)245-7314, www.JAMMConsulting.com
Eliminate junk email and reclaim your inbox.
Visit http://www.spammilter.com for details.  

> -----Original Message-----
> From: Wes Wannemacher [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, December 09, 2008 10:39 PM
> To: Struts Users Mailing List
> Subject: Re: How to output local variable as textfield label
> 
> After constructing the String, set it as an attribute on one of the
> scopes that OGNL can search (page scope is probably sufficient for
> this). 
> 
> http://struts.apache.org/2.x/docs/ognl.html
> 
> -Wes
> 
> On Tue, 2008-12-09 at 22:34 -0600, Neil Aggarwal wrote:
> > Hello:
> > 
> > I need to compose the label for a textfield.
> > 
> > Here is my JSP code:
> > <[EMAIL PROTECTED] prefix="s" uri="/struts-tags"%>
> > 
> > <% 
> > String label = "Address";
> > if( request.getAttribute("requireFullAddress") != null )
> >     label += "*";
> > %>
> > <s:textfield label="%{label}" name="address"/>
> > 
> > This does not work, I get an empty label on the page.
> > 
> > I also tried using:
> > <s:textfield label="%{#label}" name="address"/>
> > 
> > That did not work either.
> > 
> > Any ideas how I may do this?
> > 
> > Thanks,
> >     Neil
> > 
> > --
> > Neil Aggarwal, (832)245-7314, www.JAMMConsulting.com
> > Eliminate junk email and reclaim your inbox.
> > Visit http://www.spammilter.com for details. 
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


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

Reply via email to