开发者

jsp attribute value-trying to use expressions to form attribute values

开发者 https://www.devze.com 2023-01-19 03:42 出处:网络
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 somethin开发者_StackOverflowg like below but this is not valid s

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 somethin开发者_StackOverflowg 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')


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

0

精彩评论

暂无评论...
验证码 换一张
取 消