cccc.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <script type="text/javascript" src="/js/jquery.js"></script> <html> <head> <title>Title</title> </head> <body> <input type="text" id="wys"><button onclick="queding()">确定</button> </body> <script> function queding() { var aaa = $("#wys").val(); alert(aaa); window.location.href="bbbb.jsp?ccc="+aaa; //window.showModalDialog("bbbb.jsp",aaa); } </script> </html>
bbbb.jsp
<html> <head> <title>Title</title> <script type="text/javascript" src="/js/jquery.js"></script> </head> <body> <button onclick="see()">查看参数</button> </body> <script> function see(){ var obj = <%=request.getParameter("ccc")%>; //alert(obj); alert(obj); } </script> </html>
1、jsp传参 function checktask(jobName){ window.location.href="${basePath}/show/index?jobName="+jobName; } 2、action接收并传参 @Controller @RequestMapping("/show") public class Shoudetail { @RequestMapping("index") public String index(Model model, HttpServletRequest request, @RequestParam Map params) { //model.addAttribute("jobname", jobname); String jobName = (String)params.get("jobName"); request.setAttribute("jobName",jobName); return "public/task/showtask"; } } 3、jsp接收参数 var jobName = '${jobName}'