struts 标签中 JSP变量的问题

zhouhao0107 2008-03-20 03:39:51
如下图的循环操作,正常显示完了,点击后,为什么红色部分语句出现javaScript异常,应该怎么改?蓝色部分没有问题,为什么?请高手指点,不胜感激。

<logic:iterate id="List_st" name="TmpForm" property="List" indexId="indexId">
<html:checkbox name="list_st" property="flg" indexed="true" onclick="alert(' <%=indexId%> ')"/>
<input type="checkbox" onclick="alert(' <%=indexId%> ')"/>
</logic:iterate>

<logic:iterate id="List_st" name="TmpForm" property="List" indexId="indexId">
<html:checkbox name="list_st" property="flg" indexed="true" onclick="alert( <bean:write name='indexId'/> )"/>
<input type="checkbox" onclick="alert( <bean:write name='indexId'/> )"/>
</logic:iterate>
...全文
96 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
hackersun12345 2012-06-26
  • 打赏
  • 举报
回复
错了,当我没说过……
hackersun12345 2012-06-26
  • 打赏
  • 举报
回复
使用:${indexId}

1、<%=indexId%> 这里的indexId是标签里面循环出来的,直接用<%=%>是拿不到值的
2、<bean:write name='indexId'/>,这个indexId不是List_st的属性,所以也拿不出来
liujianyu4303 2012-06-26
  • 打赏
  • 举报
回复
帮顶啊
hellohwhw 2012-06-26
  • 打赏
  • 举报
回复
${indexId} 怎样才能这样显示 ?
lauraylin 2008-03-20
  • 打赏
  • 举报
回复
试试用EL
onclick="alert('${indexId}')"

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧