首页 > 技术文章 > 点击a标签的文字后页面的跳转

chuai 2017-02-24 17:14 原文

1、方法一

(1)js

var html="";

html+="<a href=\"#\" onclick=\check('"+id+"');\">点击</a>";

function check(check_id){
    window.location.href="${contextPath}/checkPage?check_id="+check_id;
}


(2)java的controller层中

@Controller
@RequestMapping("/")
public class CheckController extends BaseController {

  //页面跳转
    @RequestMapping(value="/checkPage")
    public String turnToSendPage(HttpServletRequest request,HttpServletResponse response){
        String check_id = request.getParameter("check_id");
        request.setAttribute("check_id", check_id);
        return "要跳转的页面路径";//如:return "activiti/page/turnToSendPage";
    }

}

推荐阅读