struts2 禁止url直接提交action
禁止在url直接输入xxxx/xx.do或者xxxx/xx.action 然后执行action
必须在页面中点击执行。
请问怎么实现?
              
------解决方案--------------------加session。然后用filter过滤?JSP页面在点击时产生验证通过的session?
------解决方案--------------------加一个过滤器,直接把所有get请求的都过滤掉,只接受post请求的不就完了。
------解决方案--------------------2楼正解,过滤请求的代码去百度下。。。
------解决方案--------------------http://greenyouyou.blog.163.com/blog/static/13838814720114982919987/
------解决方案--------------------
// 只接受POST方式传递的数据
		if (!"POST".equals(request.getMethod())) {
			throw new MethodErrorException("不支持非POST方式的请求!");
		}
入口强制post提交表单
------解决方案--------------------token可以解决
------解决方案--------------------赞成二楼的,自己写个过滤器就行了
------解决方案--------------------public void doFilter(ServletRequest req, ServletResponse resp,
			FilterChain chain) throws 
IOException, 
ServletException {
		HttpServletResponse response = (HttpServletResponse) resp;
		HttpServletRequest request = (HttpServletRequest) req;
		HttpSession session = request.getSession(true);
		String emplyoeeright = (String) session.getAttribute("emplyoeeright");//
		String url = request.getRequestURI();
		if (emplyoeeright == null 
------解决方案-------------------- emplyoeeright.equals("")) {
			// 判断获取的路径不为空且不是访问登录页面或执行登录操作时跳转
			if (url != null && !url.equals("")
					&& (url.indexOf("Login") < 0 && url.indexOf("login") < 0)) {
				response.sendRedirect("login.jsp");
				return;
			}
		}
		// 已通过验证,用户访问继续
		chain.doFilter(request, response);
		return;
	}