struts2 报403 错误
来源:互联网 发布:网络限制不能玩游戏 编辑:程序博客网 时间:2024/06/01 09:39
好久没有接触struts2了,今天在写一个简单的网页(jsp)的时候,在整合了struts2时发现一个问题。
详情:
jsp页面:index.jsp:输入用户名,登陆
login.jsp:登陆之后进入login页面:hello
struts2.xml:
<action name="login" class = "com.cyan.cloder.action.UserAction" method="addUser">
<result name="success">view/regist.jsp </result>
</action>
UserAction:
就一个execute:return SUCCESS;
启动就报了403的错误。HTTP Status 403 - Access to the requested resource has been denied
后来发现是因为web.xml的问题:
原web.xml:
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<!-- Restricts access to pure JSP files - access available only via Struts action -->
<security-constraint>
<display-name>No direct JSP access</display-name>
<web-resource-collection>
<web-resource-name>No-JSP</web-resource-name>
<url-pattern>*.jsp</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>no-users</role-name>
</auth-constraint>
</security-constraint>
<security-role>
<description>Don't assign users to this role</description>
<role-name>no-users</role-name>
</security-role>
更换的web.xml
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<!-- 让Struts 2的核心Filter拦截所有请求 -->
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
that's all get
- struts2 报403 错误
- Struts2 报500错误
- Struts2 报类型异常错误
- struts2 报404错误 类型
- struts2.5以上 报方法不允许错误
- 运行Struts2报java.lang.ClassNotFoundException错误
- struts2 json jpa spring 报NoSuchMethodException getTargetSource()错误
- ExtJS+Struts2提交表单报脚本错误的问题
- struts2 文件超出大小限制后报404错误
- 运行struts2程序时核心加载包struts2-core-2.3.15.1.jar报严重错误
- 访问Struts2的方法页面报404错误,后端没有错误显示
- Struts2错误
- 今天开始学习Struts2 @_@ 马上就碰到问题了..人衰么? 关于 struts2.2.1启动报javassist....错误
- web.xml配置struts2之后访问jsp页面报Http 404错误
- 关于struts2的redirectAction报类似“Multiple annotations found at this line:”错误
- 配置Struts2时,报没有action与form表单填写的action对应的错误。
- struts2设置了excludePattern报could not found action or re.错误
- Struts2.3动态调用报 No result defined for action 错误
- Linux常用命令
- react+redux 前端开发流程
- Spring+quartz定时任务(配置)
- Redis无法保存ef复杂对象
- LeetCode Search for a Range
- struts2 报403 错误
- 深度学习入门(写的很好)
- 【POJ2186】Popular Cows 有向图强连通分量详解(再水一篇怕被骂、、所以。。)
- linux mmap用法:
- NSInteger转换时间格式字符串和模糊计数字符串
- 从尾到头打印链表
- session是否过期
- 微信群发图文消息步骤说明
- 交叉模拟——均分纸牌