You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jonathan Hawkins <jh...@chestnet.org> on 2003/10/13 16:26:35 UTC
JSP Expression inside Struts html:text property
Howdy -
I have some JSP code that looks like this:
<% for(int x=1;x <=7;x++){ %>
<html:text property="person<%=x%>" value=""/>
<% } %>
of course I was expecting the HTML output to be something like:
<input type="text" name="person1" value="">
<input type="text" name="person2" value="">
<input type="text" name="person3" value="">
<input type="text" name="person4" value="">
<input type="text" name="person5" value="">
<input type="text" name="person6" value="">
<input type="text" name="person7" value="">
Instead I am getting :
<input type="text" name="person<%=x%>" value="">
<input type="text" name="person<%=x%>" value="">
<input type="text" name="person<%=x%>" value="">
<input type="text" name="person<%=x%>" value="">
<input type="text" name="person<%=x%>" value="">
<input type="text" name="person<%=x%>" value="">
<input type="text" name="person<%=x%>" value="">
Anyone have another way to achieve the desired output? I looked into
the html:logic tag and think that may be the way to go, but I can't
find an example
Please help........super powers......failing.........must .....stop
evil........bad code before it's........too late............
thanks
jonathan
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: JSP Expression inside Struts html:text property
Posted by Nicolas De Loof <ni...@cgey.com>.
When you want to use Runtime Expression in a JSP tag, the full tag attribute value must be RTexpression, not just part
of it :
<html:text property="<%= \"person\" + x %>" value=""/>
In your case you should think using indexed properties and logic:iterate to display your datas.
Nico.
----- Original Message -----
From: "Jonathan Hawkins" <jh...@chestnet.org>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Monday, October 13, 2003 4:26 PM
Subject: JSP Expression inside Struts html:text property
> Howdy -
>
> I have some JSP code that looks like this:
>
>
>
> <% for(int x=1;x <=7;x++){ %>
> <html:text property="person<%=x%>" value=""/>
> <% } %>
>
>
> of course I was expecting the HTML output to be something like:
>
> <input type="text" name="person1" value="">
> <input type="text" name="person2" value="">
> <input type="text" name="person3" value="">
> <input type="text" name="person4" value="">
> <input type="text" name="person5" value="">
> <input type="text" name="person6" value="">
> <input type="text" name="person7" value="">
>
> Instead I am getting :
>
>
> <input type="text" name="person<%=x%>" value="">
> <input type="text" name="person<%=x%>" value="">
> <input type="text" name="person<%=x%>" value="">
> <input type="text" name="person<%=x%>" value="">
> <input type="text" name="person<%=x%>" value="">
> <input type="text" name="person<%=x%>" value="">
> <input type="text" name="person<%=x%>" value="">
>
> Anyone have another way to achieve the desired output? I looked into
> the html:logic tag and think that may be the way to go, but I can't
> find an example
> Please help........super powers......failing.........must .....stop
> evil........bad code before it's........too late............
>
>
> thanks
> jonathan
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org