简体   繁体   English

在JavaScript中读取Struts2标签值

[英]reading Struts2 tag values in javascript

I am using struts2 with jsp. 我在jsp中使用struts2。 In Jsp, i have a table in which few rows of data are present. 在Jsp中,我有一个表,其中存在几行数据。 I have used iterators to display row data of table. 我已经使用迭代器来显示表的行数据。 Each row contains a button to update the row data(like priority of row data). 每行包含一个用于更新行数据的按钮(例如行数据的优先级)。 I am trying to use javascript to update row data when a button is clicked. 我正在尝试使用javascript单击按钮时更新行数据。 I am not able to access the value of button. 我无法访问button的值。 I am not able to find which button is clicked (since one button is present for eahc row of data). 我找不到单击的按钮(因为存在一个按钮,用于eahc行数据)。 I tried using below script. 我尝试使用下面的脚本。 not working. 不工作。 :( :(

function show_alert() { var partnumber = document.getElementById("stop").Value; 函数show_alert(){var partnumber = document.getElementById(“ stop”)。Value; alert(partnumber); 警报(零件号); } Also, please let me know if it is possible to access values of struts2 tag values (which are with in iterator tag). }另外,请让我知道是否可以访问struts2标记值的值(在迭代器标记中)。
Please help me out. 请帮帮我。

Thanks in advance. 提前致谢。 regards, hemanth. 问候,实力。

You'll need make the buttons have unique ids. 您需要使按钮具有唯一的ID。 You can use the iterator's status object to appending the index to the id. 您可以使用迭代器的状态对象将索引附加到ID上。

http://struts.apache.org/2.1.6/docs/iterator.html http://struts.apache.org/2.1.6/docs/iterator.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM