javaweb项目已经发布起来了,可是输入controller对应的地址,总是自己跳转到login?
天蓬老师
天蓬老师 2017-04-18 10:55:58
0
2
581

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";
    }
天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

全部回覆(2)
Ty80

請求這條位址可能需要一些登入資訊什麼的做驗證,在ajax裡請求會把這些訊息傳過去,
你直接瀏覽器輸入不帶有這些訊息就會被security過濾器給攔截轉發到登入頁面了。

刘奇


可能是這個過濾器攔截到了你的請求
專案是你一個人在負責嗎?如果不是這種問題最好問同一個專案組的同事

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!