如何在Modal Popup窗口中显示JSP页面? [英] How to show JSP page in Modal Popup window?

查看:65
本文介绍了如何在Modal Popup窗口中显示JSP页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Jsp东西很陌生.我要实现的目的是在service.jsp页面中显示另一个jsp页面的内容,比如说help.jsp,但是只有在用户单击时才能显示?图像(?图像表示帮助).我想在弹出窗口中显示help.jsp的内容,同时也希望主屏幕淡出或变得难以处理.

I am pretty much new to Jsp stuff. What I am trying to achieve is to show contents of another jsp page lets say help.jsp in service.jsp page but only when user click ? image (? image represents help). I want to show the contents of help.jsp in a popup window and also at the same time want the main screen to fade out or non intractable.

这是我到目前为止所做的.我在service.jsp

Here is what I am doing so far. I have created a div in service.jsp

<div id="dialog" title="Basic dialog">

</div>

并创建了javascript函数

and created a javascript function

function openDialog() {
        $("#dialog").load('/myaccount/registration/help.jsp').dialog({modal: true});
    }

我的锚标记看起来像这样

My anchor tag looks like this

 <a tabindex="1005" href="#"  onclick="openDialog();" onMouseOver="window.status='Launch Help Window'; return true" onMouseOut ="window.status='';return true"><span class="WhiteBody"><img src="images/icon_help.gif" border="0"></span></a>

当我单击帮助"按钮时,它将重定向到空白页.

When I click help button it redirect to a blank page.

请帮助我!

推荐答案

在您的HTML中,

<button id="myButton">click!</button>

<div id="dialog" title="Dialog box">
  My content // Have to add your jsp page here
</div>

在您的脚本中,

$(function() {

  $("#dialog").dialog({
     autoOpen: false,
     modal: true
   });

  $("#myButton").on("click", function(e) {
      e.preventDefault();
      $("#dialog").dialog("open");
  });

});

有关工作示例,请参见 小提琴 .

See the Fiddle for working sample.

这篇关于如何在Modal Popup窗口中显示JSP页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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