JSP Expression Problem

Hey all.

I am getting a very confusing problem in one of my jsps.
I need to loop through an Arraylist object, and display each object in a table on my page.
Two of the properties must be displayed in dropdown lists(html:select). These need to be accessable from javascript, as when you set the first one to a specific value, the second one must be set to disabled. Seeing as there could be any amount of them, I need to set the Ids as I iterate through the list, with an incrementing number, and the use the <%= %> tags to add it to the end. So the the id for the first html:select is styleId="select<%=i%>", where i is the int that increments. So the ids should be select1, select2, select3 etc... if im not mistaken... which I guess I must be. It is the same for the other select, styleId="hideEmail<%=i%>", and I call the javascript method like so: onchange="checkFields('<%=i%>')".
I tried displaying the value in an alert in the javascript, and it displays <%=i%> in the alert...
It should be showing 1. As far as i can see anyway...

Any assistance or insight would be greatly appreciated.

Thanks in advance.
<% int i=0;%>
<logic:iterate id="companyDetails" name="CompanyDetailsObj">
	<% if( i % 2 == 0) {%><tr class="even"><%}else{%>
	<tr><%} i++;%>
		<html:select property="type" styleClass="" styleId="select<%=i%>" name="companyDetails" onchange="checkFields('<%=i%>')">
			<html:options collection="GetNumberTypeObj" property="optionValue" labelProperty="optionText"/>
		<html:select property="country" styleClass="" styleId="hideEmail<%=i%>" 	name="companyDetails">
			<html:options collection="GetCountryObj" property="optionValue" labelProperty="optionText"/>
		<td><html:text name="companyDetails" property="number"/></td>
		<td><html:text name="companyDetails" property="defaults"/></td>

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jacoalbAuthor Commented:
Turns out struts gets confused by



<% String selectId="select"+String.valueOf(i); %>
 styleId="<%= selectId %>"

is required.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java App Servers

From novice to tech pro — start learning today.