struts2:如何调出弹出窗口 [英] struts2 : How to bring up a pop up window

查看:245
本文介绍了struts2:如何调出弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Struts 2应用程序.我有一个JSP页面,其中有一个普通的html表.在其中一列中,我有一个名为"更新"的链接.当我单击"更新"时,将打开一个新的弹出窗口,该弹出窗口将包含当前行的许多其他详细信息(这意味着它必须通过一些操作并从数据库中获取数据).

I am working on a Struts 2 application .I have a JSP page in which there is a normal html table. 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 .

如何在struts 2中创建此弹出窗口?

How do I create this popup in struts 2?

应该是与父窗口相同的形式,还是不同的形式?

Should it be the same form as the parent window or a different one ?

如果您可以提供一些教程的链接,那将有很大的帮助.我无法在Google搜索中找到它.

It would be of great help , if you can give links to some tutorial . I am not able to find it in google search .

推荐答案

这是与javascript有关的问题,而不是struts2.我想您必须在表定义中为链接update使用此语法.

Its a problem related to javascript not struts2.I guess you must be using this syntax in the table definition for link update .

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

其中anyValueYouwantToSend可能是您要发送以标识特定行的某些标识符值 然后用Javascript

where anyValueYouwantToSendmay be some identifier value you want to send to identify the particular row Then in 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");
}

其中myAction将是您要执行数据库操作的操作.在此操作的操作映射中,您需要将结果提供给一个jsp,该jsp将成为您的弹出窗口.当然,弹出式窗口的提交方式会有所不同,但是您在此处执行的更新仅在刷新后才会反映在父窗口中.如果要在不刷新父窗口的情况下反映这些更改,则需要编写一些父子javascript ,如果您愿意,我可以帮助您

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

这篇关于struts2:如何调出弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆