shiro登录页面 显示404

青柠-柠 2017-10-07 07:34:17
jsp 页面都放在了 web-inf文件夹下
shiro过滤器[
 <!-- 11Shiro的Web过滤器 -->
<bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
<property name="securityManager" ref="securityManager"/>
<property name="loginUrl" value="/login"/>
<property name="successUrl" value="/"/>
<property name="unauthorizedUrl" value="/unauthorized.jsp"/>
<!--<property name="filters">-->
<!--<util:map>-->
<!--<entry key="sysUser" value-ref="sysUserFilter"/>-->
<!--</util:map>-->
<!--</property>-->
<!--Shiro过滤链的定义-->
<!-- anon:例子/admins/**=anon 没有参数,表示可以匿名使用。-->
<property name="filterChainDefinitions">
<value>
/ui/** = anon
/user/login = anon
/login = anon
/unauthorized = anon
/** = user
</value>
</property>
</bean>

controller层
<!--配置渲染器-->
<bean id="jspViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
<!--结果视图的前缀-->
<property name="prefix" value="/WEB-INF/jsp/"/>
<!--结果视图的后缀-->
<property name="suffix" value=".jsp"/>
<!--这样就会自动去找 /web-inf/jsp/hello.jsp 去了-->
</bean>



页面显示 404
...全文
453 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
Alan老三 2018-10-24
  • 打赏
  • 举报
回复
会不会是跳转页面的url写的不对,我就是这个问题
青柠-柠 2017-10-08
  • 打赏
  • 举报
回复
web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1"> <display-name>Archetype Created Web Application</display-name> <!--Spring 编码过滤器--> <filter> <filter-name>characterEncodingFilter</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> <init-param> <param-name>forceEncoding</param-name> <param-value>true</param-value> </init-param> </filter> <filter-mapping> <filter-name>characterEncodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!--log4j的日志配置--> <!--<context-param>--> <!--<param-name>log4jConfigLocation</param-name>--> <!--<param-value>/WEB-INF/classes/log4j.properties</param-value>--> <!--</context-param>--> <!--<context-param>--> <!--<param-name>log4jRefreshInterval</param-name>--> <!--<param-value>60000</param-value>--> <!--</context-param>--> <!--<!– 需要添加spring-web.jar包,否则用发生错误信息 –>--> <!--<listener>--> <!--<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>--> <!--</listener>--> <!--Shiro过滤器定义--> <filter> <filter-name>shiroFilter</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> <init-param> <!--该值缺省值为false,表示生命周期由SpringApplicationContext管理,设置为true则表示由ServletContainer管理--> <param-name>targetFilterLifecycle</param-name> <param-value>true</param-value> </init-param> </filter> <filter-mapping> <filter-name>shiroFilter</filter-name> <url-pattern>/*</url-pattern> <dispatcher>REQUEST</dispatcher> </filter-mapping> <!--支持GET,PUT,POST,与Delete请求--> <filter> <filter-name>hiddenHttpMethodFilter</filter-name> <filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class> </filter> <filter-mapping> <filter-name>hiddenHttpMethodFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!--加载spring容器--> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:spring/applicationContext-*</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <!--获取Request和Session--> <!--<listener>--> <!--<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>--> <!--</listener>--> <servlet> <servlet-name>springmvc</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:spring/springMVC.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>springmvc</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> </web-app>
tianfang 2017-10-08
  • 打赏
  • 举报
回复
项目的web.xml配置了项目的根目录了吗 没有,url中就需要加上默认的项目名
青柠-柠 2017-10-08
  • 打赏
  • 举报
回复
怎么配置?我还不会...谢谢

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧