Struts2 令牌

xiaoxiao2021-02-28  82

1:令牌机制的背景及意义

解决重复提交表单问题

利用token拦截器实现

2:实现令牌验证的步骤

第一步:jsp页面加入标签支持<%@ taglib uri=”/struts-tags” prefix=”s” %>

第二步:表单中加入 <s:token></s:token>

第三步:struts.xml中在需要验证重复提交的action中加入验证拦截器 <interceptor-ref name="token" /> <interceptor-ref name="defaultStack"></interceptor-ref> <result name="invalid.token">repeatsubmit.jsp</result>

转载请注明原文地址: https://www.6miu.com/read-60189.html

最新回复(0)