Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Struts and the fly likes JSP expression inside html:text attribute Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "JSP expression inside html:text attribute" Watch "JSP expression inside html:text attribute" New topic

JSP expression inside html:text attribute

J Mascis

Joined: Oct 13, 2003
Posts: 1
Howdy -
I have some code such as:
<% for(int n=1;n <= 7;n++){ %>
<td colspan="6">
<html:text property="person<%= n %>_name_first" size="22" value="" maxlength="64"/>
<% } %>
Unfortunately, Struts ignores the scriptlet portion in the tag <%= n %>
Instead of the variable incrementing as I thought it would, the html output is <%= n %> and not the number I want to concatenate into the html output.
Anyone know of how I can get around this?? It works fine in standard ht markup but Struts converts the property into a straight up string. Ack, Please, help.....super powers.....failing........arch enemy.......winning
Eric Sexton
Ranch Hand

Joined: Sep 12, 2003
Posts: 133
Dude! Where you been? (Did you get that ref?) I've been so bummed since you stopped doing Dinosaur Jr. The Fog is cool though. Keep on rockin'.
Now to get to your problem. I had a similar problem and this is how I got around it:

Does that help?
Mike Watt
I agree. Here's the link:
subject: JSP expression inside html:text attribute
It's not a secret anymore!