Heim  >  Fragen und Antworten  >  Hauptteil

javaweb项目已经发布起来了,可是输入controller对应的地址,总是自己跳转到login?

web.xml中没看出异常啊?

比如输入http://localhost:8080/dyn2/dy...
会自动调整到http://localhost:8080/dyn2/login

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
 <description>Dynamic Matrix powered by Spring</description>
 <display-name>Dynamic Matrix</display-name>
 <context-param>
  <param-name>webAppRootKey</param-name>
  <param-value>dyn2.root</param-value>
 </context-param>
 <context-param>
  <param-name>log4jConfigLocation</param-name>
  <param-value>/WEB-INF/log4j.properties</param-value>
 </context-param>
 <context-param>
  <param-name>contextConfigLocation</param-name>
  <param-value>/WEB-INF/applicationContext.xml</param-value>
 </context-param>
 <filter>
  <filter-name>characterEncodingFilter</filter-name>
  <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
  <init-param>
   <param-name>encoding</param-name>
   <param-value>utf8</param-value>
  </init-param>
 </filter>
 <!--<filter>
  <filter-name>ContentTypeFilter</filter-name>
  <filter-class>net.counters.dynm.web.ContentTypeFilter</filter-class>
  <init-param>
   <param-name>charset</param-name>
   <param-value>utf8</param-value>
  </init-param>
 </filter>
 -->
 <filter>
  <filter-name>springSecurityFilterChain</filter-name>
  <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
 </filter>
 <!-- <filter>
  <filter-name>UrlRewriteFilter</filter-name>
  <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
 </filter> -->
 <filter-mapping>
  <filter-name>characterEncodingFilter</filter-name>
  <url-pattern>/*</url-pattern>
 </filter-mapping>
 <!--<filter-mapping>
  <filter-name>ContentTypeFilter</filter-name>
  <url-pattern>/*</url-pattern>
 </filter-mapping>
 -->
 <filter-mapping>
  <filter-name>springSecurityFilterChain</filter-name>
  <url-pattern>/*</url-pattern>
 </filter-mapping>
 <!-- <filter-mapping>
  <filter-name>UrlRewriteFilter</filter-name>
  <url-pattern>/*</url-pattern>
 </filter-mapping> -->
 <listener>
  <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
 </listener>
 <listener>
  <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
 </listener>
 <listener>
     <listener-class>org.springframework.web.util.HttpSessionMutexListener</listener-class>
 </listener>
 <servlet>
  <servlet-name>dynMatrix</servlet-name>
  <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  <load-on-startup>1</load-on-startup>
 </servlet>
 <!-- <servlet-mapping>
  <servlet-name>dynMatrix</servlet-name>
  <url-pattern>/app/*</url-pattern>
 </servlet-mapping> -->
 <servlet-mapping>
  <servlet-name>dynMatrix</servlet-name>
  <url-pattern>/</url-pattern>
 </servlet-mapping>
 <session-config>
     <session-timeout>60</session-timeout>
 </session-config>
 <error-page>
  <error-code>403</error-code>
  <location>/errors/403.html</location>
 </error-page>
</web-app>

这是controller

    @RequestMapping(value="/create",method=RequestMethod.GET)
    public String getCreateForm(Model model){
        this.addEnableMap(model);
        model.addAttribute(new WebUser());
        //加载分类
        String cwhere = " where type_parent_id=0";
        List<CheckListType> checkListType = checkLMDao.getCheckListTypeByWhere(cwhere, 0, 0);
        
        model.addAttribute("checkListType", checkListType);
        return "createUserForm";
    }
天蓬老师天蓬老师2742 Tage vor593

Antworte allen(2)Ich werde antworten

  • PHP中文网

    PHP中文网2017-04-18 10:57:58

    请求这条地址可能需要一些登录信息什么的做验证,在ajax里请求会把这些信息传过去,
    你直接浏览器输入不带有这些信息就会被security过滤器给拦截转发到登录页面了。

    Antwort
    0
  • 怪我咯

    怪我咯2017-04-18 10:57:58


    可能是这个过滤器拦截到了你的请求
    项目是你一个人在负责吗?如果不是这种问题最好问同一个项目组的同事

    Antwort
    0
  • StornierenAntwort