2014-03-29 34 views
1

後按鈕動作我用瀏覽器進行以下豆沒有能夠註銷後回去Spring MVC中禁用回註銷

<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"> 
     <property name="cacheSeconds" value="0" /> 
    </bean> 

在春季3.2.8.RELEASE這個類是如此不贊成我所用以下

@Bean 
    public RequestMappingHandlerAdapter requestMappingHandlerAdapter() { 

     RequestMappingHandlerAdapter rmha = new RequestMappingHandlerAdapter(); 
     rmha.setCacheSecondsForSessionAttributeHandlers(0); 

     return rmha; 
    } 

但我無法停止後退按鈕操作。我的意思是它在註銷後返回頁面。

我在哪裏犯錯? 如何解決這個問題?

回答

4

cacheSeconds是來自WebContentGenerator的繼承方法。

這是AnnotationMethodHandlerAdapterRequestMappingHandlerAdapter的情況。

因此,所有你需要做的就是叫你調用了正確的方法之前:

RequestMappingHandlerAdapter rmha = new RequestMappingHandlerAdapter(); 
rmha.setCacheSeconds(0);