tags:

views:

30

answers:

1

I am facing a basic problem in my jsp. I have a jsp. There is a div element that is part of a loop .So here x is a counter. I am trying something like below but this is not valid syntax.

<% for (int x =0; x <5; x++) { %> 
 <s:div theme="ajax" id = <%=x%>  
   <s:form>   
      <s:submit theme="ajax" targets = '<%=x%>' />     
   </s:form> 
 </s:div> 
< % } % > 

Could you please help? The problem is that id = <%=x%> or targets = '<%=x%>' seems to be invalid syntax. My goal is to have 'id' attribute and 'targets' attribute hold a dynamic value(based on value of counter 'x')

A: 

You should close the first s:div and mark the id with quotes : <s:div theme="ajax" id="<%=x%>">

kukudas