将servlet状态重定向到模态html页面

时间:2017-01-04 22:12:52

标签: javascript servlets

我有一个包含表单填充的HTML页面,提交将触发servlet在数据库中创建新记录。

一旦servlet完成了这项工作,我想通过打开一个指示命令状态的弹出模式(失败,成功)来重定向发出表单的同一个HTML页面。

我用Google搜索了我的问题并找到了一些sendRedirect和modal_popup的解决方案,但我无法正常工作......

这是我想通过response.sendRedirect

从我的servlet调用的模态
<script type="text/javascript">
function pop_up_modal() {
$( "#modal_popup" ).dialog({
  height: 140,
  modal: true,
  title: "The title of your modal popup",
  open: function(){
    $( "#modal_popup" ).append("The text that you want in the modal.");
  }
});

};

当最终用户点击模态的ok按钮时,我想打开另一个显示所有记录的HTML页面......

我尝试使用

调用Javascript方法
    PrintWriter out = response.getWriter();
    out.print("<script type=\"text/javascript\">pop_up_modal();</script>");
    out.close();

但我有以下错误Uncaught ReferenceError: pop_up_modal is not defined

任何帮助将不胜感激!

0 个答案:

没有答案