Java 从安全约束中排除欢迎页面或webroot(/仅限)

Java 从安全约束中排除欢迎页面或webroot(/仅限),java,security,struts2,Java,Security,Struts2,我正在努力进行web.xml配置 这就是我所拥有的 <welcome-file-list> <welcome-file>/jsp/index.jsp</welcome-file> </welcome-file-list> <security-constraint> <display-name>Unsecure pages</display-name> <web-resource-collecti

我正在努力进行web.xml配置 这就是我所拥有的

<welcome-file-list> 
<welcome-file>/jsp/index.jsp</welcome-file> 
</welcome-file-list> 

<security-constraint> 
<display-name>Unsecure pages</display-name> 
<web-resource-collection> 
<web-resource-name>Unsecure pages</web-resource-name> 
<url-pattern>/jsp/index.jsp</url-pattern> 
</web-resource-collection> 
</security-constraint> 


<security-constraint> 
<display-name>Secure root resources</display-name> 
<web-resource-collection> 
<web-resource-name>Secure root resources</web-resource-name> 
<url-pattern>/*</url-pattern> 
</web-resource-collection> 
<auth-constraint> 
<role-name>RoleA</role-name> 
</auth-constraint> 
</security-constraint> 


<security-constraint> 
<display-name>Specific secure recourses</display-name> 
<web-resource-collection> 
<web-resource-name>Specific secure recourses</web-resource-name> 
<url-pattern>/home</url-pattern> 
<url-pattern>/search</url-pattern> 
</web-resource-collection> 
<auth-constraint> 
<role-name>RoleA</role-name> 
<role-name>RoleB</role-name> 
</auth-constraint> 
</security-constraint> 

and in the index.jsp i have this 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 
<html> 
<head> 
<title>TITLE</title> 
<meta http-equiv="REFRESH" content="0; url=/mpbo/home"></HEAD> 
</HTML> 

/jsp/index.jsp
不安全页面
不安全页面
/jsp/index.jsp
安全的根资源
安全的根资源
/* 
罗莱亚
特定安全资源
特定安全资源
/家
/搜寻
罗莱亚
罗勒布
在index.jsp中,我有一个
标题
我想要实现的是,RoleA应该能够完全访问该网站,RoleB应该只能访问主页和搜索页面 RoleA和RoleB的主页都是默认的

我遇到的问题只是RoleB中的用户 当我作为RoleB的用户时
http://localhost:8080/mpbo/
系统会提示我进入登录页面,我正常登录,然后重定向到/jsp/index.jsp(欢迎文件),该文件试图将我重定向到/mpbo/home文件夹,但在这里,我的访问被拒绝。 如果在登录后直接浏览到/mpbo/home文件夹,则该文件夹已成功 如果我直接浏览到/jsp/index.jsp文件,它将成功地将我重定向到/mpbo/主页

因此,我认为问题在于,实际情况对其有限制。 我试着添加一个url模式,有/只有和没有约束,甚至有RoleA和RoleB,但也不起作用

你知道我该怎么做吗