Home  >  Q&A  >  body text

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 days ago592

reply all(2)I'll reply

  • PHP中文网

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

    Requesting this address may require some login information for verification. The request in ajax will pass this information.
    If you directly enter the browser without this information, it will be intercepted by the security filter and forwarded to the login page. .

    reply
    0
  • 怪我咯

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


    Maybe this filter intercepted your request
    Are you responsible for the project alone? If it’s not a question like this, it’s best to ask colleagues in the same project team

    reply
    0
  • Cancelreply