当前位置:编程学习 > JAVA >>

struts字符串拼接之后获得map的key再取出对应的value



<s:iterator value="#pro" status="sta">
  <tr>
  <td>
  <s:set value="#{'16978':'data1','169777':'data2','1697822','data3'}" name="ms_%{#sta.index}"/>
  <s:property value="#ms_%{#sta.index}['16978']"/><s:textfield id="#ms_%{#sta.index}['16978']" name="#ms_%{#sta.index}['16978']"></s:textfield>
  <!--<a href="${productId}${productName}<s:property value='#sta.index'/>"><s:property value="productId"></s:property></a>
  --></td>
  <td><a href=""><s:property value="%{#sta.index + #sta.index }"/><s:property value="productName"></s:property></a></td>
  </tr>
  </s:iterator>



如上诉代码段,iterator里面是一个list,s:set里面是一个map,为了方便看我已经写死了,是从数据库取出来的,用<s:property value="#ms_%{#sta.index}['16978']"/>取出map里面16978的值,如此,取不出来,但是用<s:textfield id="#ms_%{#sta.index}['16978']" name="#ms_%{#sta.index}['16978']"></s:textfield>却可以取出来,想问如何用<s:property />取出值来,在真正的程序里面,这个16978也是从list里面取出来当前的id,这里方便解决问题,写死了,求教 javaee --------------------编程问答--------------------
补充:Java ,  Java EE
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,