jsp页面之间的跳转和返回

1、点击按钮跳转到新的页面
<a href="javascript:searchAreaChannel('{$T.record.area_code}')" title="查询渠道信息">查询渠道信息</a>

2、js调用跳转接口
//查询某地区下的渠道
		function searchAreaChannel(area_code) {
			window.location.href = "areaChannelList.do?area_code="+area_code;
		}

3、Controller代码控制跳转到新的页面(带参数跳转)
@RequestMapping(value = "/areaChannelList")
	public ModelAndView areaChannelList(HttpServletRequest request) {
		request.setAttribute("area_code", request.getParameter("area_code"));
		return new ModelAndView("/WEB-INF/views/area/searchAreaChannel.jsp");
	
	}

4、新页面执行某些操作(略)

5、点击返回按钮,回退到上一个页面
function edit_cancel(type) {
			window.history.back(-1); 
		}

猜你喜欢

转载自zhenxingluo918.iteye.com/blog/2215264