struts2中出现403异常
struts2中出现403错误
这是项目的目录
浏览器访问action时总是出现403错误
HTTP Status 403 - Access to the requested resource has been denied
------解决思路----------------------
403应该是权限被拒绝。你的jsp文件的权限重新设置下试试。
windows下使用文件夹属性安全性设置
linux系统使用chmod -R 777 设置
这是struts.xml配置
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<package name="itcast" namespace="/test" extends="struts-default">
<action name="helloworld" class="first.HelloWorldAction" method="execute" >
<result name="success">/WEB-INF/hello.jsp</result>
</action>
<action name="redirect" class="first.HelloWorldAction" method="execute">
<result name="success" type="redirect">page/Userinfo.jsp?user=${user.name }</result>
</action>
</package>
</struts>
这是要访问的action
package first;
import bean.User;
public class HelloWorldAction {
private String msg;
private User user;
public String getMessage() {
return msg;
}
public User getUser(){
return user;
}
public String execute(){
msg = "第一个struts2应用";
user=new User();
user.ini();
return "success";
}
}
这是要重定向到的jsp页面
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
</body>
</html>
这是项目的目录
浏览器访问action时总是出现403错误
HTTP Status 403 - Access to the requested resource has been denied
------解决思路----------------------
403应该是权限被拒绝。你的jsp文件的权限重新设置下试试。
windows下使用文件夹属性安全性设置
linux系统使用chmod -R 777 设置