【问题标题】:How to open popup window in Struts 2如何在 Struts 2 中打开弹出窗口
【发布时间】:2015-10-06 10:04:00
【问题描述】:

我正在尝试在单击链接时打开一个新窗口。我正在使用 Struts 2 中的以下代码执行此操作。我还需要传递归档 bankAccountNumber 的值。

   ....
    <tr>
     <td align="center" width="16%">More Details 
       <a href='<s:url action='getEmployeeMoredetails' escapeAmp="false" >
        <s:param name='bankAccountNumber' value='bankAccountNumber' />
        </s:url>' target="_blank">
       <font size="2" color="BLUE"><b>More Details</b></font>
      </a>
     </td>
    </tr>
   ....

现在上面的代码工作正常,它在一个单独的窗口中打开页面,它还传递了字段的值。但我想在弹出窗口中打开它。我不确定如何在 Struts 中使用 window.open() 方法来执行此操作并传递值。有没有其他方法可以做到这一点?

【问题讨论】:

  • 你确定你想要的是一个弹出窗口吗?那是一项非常古老的技术。查看模态叠加层、iframe 等...看看它们是否符合您的需求

标签: jquery jsp struts2 popup struts2-jquery


【解决方案1】:

适当的代码是使用 JQuery UI dialog 包裹 struts2-jquery 代码库。 Dialog 小部件呈现带有远程内容的 HTML 对话框。

<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<html>
  <head>
    <sj:head jqueryui="true"/>
  </head>
  <body>
    <s:url var="remoteurl" action="getEmployeeMoredetails" escapeAmp="false"><s:param name='bankAccountNumber' value='bankAccountNumber' /></s:url>
    <sj:dialog id="mydialog" href="%{remoteurl}" title="More Details" autoOpen="false"/>
   <sj:a openDialog="mydialog">More Details</sj:a>
  </body>
</html>

【讨论】:

  • 感谢 Roman C 的回复。我试过了,但它不适合我
猜你喜欢
  • 1970-01-01
  • 2023-02-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多