繁体   English   中英

单击按钮并重定向到父窗口时显示状态弹出窗口-SpringBoot

[英]Display a status popup when a button is clicked and redirect to the parent window - SpringBoot

我创建了一个Spring Boot应用程序,当我点击localhost:8080/displayResults时,它在浏览器中显示下表。

╔═════╦══════╦════════════════════╗
║ ID  ║ Name ║       Action       ║
╠═════╬══════╬════════════════════╣
║ 001 ║ one  ║ start|stop|restart ║
║ 002 ║ two  ║ start|stop|restart ║
╚═════╩══════╩════════════════════╝

我有一个如下的控制器

@RequestMapping(value = "displayResults", method = RequestMethod.GET)
public ModelAndView getResults(ModelMap model) {
    List<Bean> beanToDisplay = handler.getData();
    return new ModelAndView("Results", "beanToDisplay", beanToDisplay);
}

上面的控制器是显示上述表格的控制器。

现在我的要求是,当我单击“ start按钮,“ stop按钮或“ restart按钮时,它应调用另一个名为handler.stop()等的方法。此方法检查服务器的现有状态并相应地启动或停止。 此方法需要一段时间(可能需要10秒钟)才能返回状态。 在此之前,单击“开始或停止或重新启动”按钮后,它应立即显示弹出窗口,然后重定向回同一父页面。 另外,我还需要将IDstart点击一起传递给控制器

我该如何实现?

alert("alert here");

是使弹出框显示的简单js方法

对于其余的我会做类似的事情

function myFunction() {
var button //define the button here

 if (button === "GetKeyDown") 
  {
   window.location='http://www.website.com';
   alert("alert here");               
  }
}

这是我能想到的最好的,因为一段时间以来我对js的工作还不多

暂无
暂无

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

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