点击a标签的文字后页面的跳转

时间:2022-06-19 14:38:29

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";
    }

}