servelet中:
@Override
protected void doPost(HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse) throws ServletException, IOException {
httpServletResponse.setContentType(CONTENT_TYPE);
PrintWriter out = httpServletResponse.getWriter();
out.write("<script language='javascript'>alert('提交成功,你的信息已经进入审核状态...');" +
"location.href='"+httpServletRequest.getContextPath()+"/index.jsp';</script>");
}
jsp中:
$("#grfw").click(function(){
var lx = '<%=lx%>'; //类型
if(lx != null && lx=='QY'){
location.href="${pageContext.request.contextPath}/pages/xgfw/dwfw/dwfwIndex.jsp"; //单位服务
}else if(lx != null && lx=='XS'){
location.href="${pageContext.request.contextPath}/pages/xgfw/xsfw/xsfwIndex.jsp"; //学生服务
}
});
---摘自就业前台