简体   繁体   English

struts2:如何调出弹出窗口

[英]struts2 : How to bring up a pop up window

I am working on a Struts 2 application .I have a JSP page in which there is a normal html table. 我正在使用Struts 2应用程序。我有一个JSP页面,其中有一个普通的html表。 In one of the columns , I have a link called ' update ' . 在其中一列中,我有一个名为“ 更新 ”的链接。 When I click on the ' update ' , a new popup window will open and the pop up will have many other details of the current row (which means it has to pass through some action and fetch data from database). 当我单击“ 更新 ”时,将打开一个新的弹出窗口 ,该弹出窗口将包含当前行的许多其他详细信息(这意味着它必须通过一些操作并从数据库中获取数据)。

There is a Submit button in popup , which when clicked , must submit the edited data . 弹出窗口中有一个“提交”按钮,单击该按钮必须提交已编辑的数据。

How do I create this popup in struts 2? 如何在struts 2中创建此弹出窗口?

Should it be the same form as the parent window or a different one ? 它应该是与父窗口相同的形式,还是不同的形式?

It would be of great help , if you can give links to some tutorial . 如果您可以提供一些教程的链接,那将有很大的帮助。 I am not able to find it in google search . 我无法在Google搜索中找到它。

Its a problem related to javascript not struts2.I guess you must be using this syntax in the table definition for link update . 这是一个与javascript有关的问题,不是struts2。我想您必须在表定义中使用此语法进行链接update

<tr><a href="javascript:update('<s:proerty value="anyValueYouwantToSend"/>')">Update</a></tr>

where anyValueYouwantToSend may be some identifier value you want to send to identify the particular row Then in Javascript 其中anyValueYouwantToSend可能是您要发送以标识特定行的某些标识符值,然后在Javascript中

function update(value){
  var url="myAction?someVariable=value";
  window.open(url,"_blank","directories=no, status=no,width=1400, height=870,top=0,left=0");
}

where myAction will be the action in which you are going to do your database stuff.In the action mapping of this action you need to give result to a jsp which is going to be your pop-up window.And of course popup window will have a different form to submit, however the update you perform here will be reflected in the parent window only when you refresh it.If you want to reflect these changes without refreshing the parent window you need to write some parent child javascript, which i can help you to do if you want 其中myAction将是您要执行数据库操作的操作。在此操作的操作映射中,您需要将结果提供给一个jsp,它将成为您的弹出窗口。当然,弹出窗口将具有提交不同的表单,但是您在此处执行的更新仅在刷新时才会显示在父窗口中。如果要在不刷新父窗口的情况下反映这些更改,则需要编写一些父子javascript,我可以为您提供帮助你想做什么

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

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