2012-07-15 56 views
0

以下是我的代码结构Spring框架访问会话变量

Filter A{ 


    Helper B()     // Call to Helper B 
    int a= HelperA.function(); 
} 

像这些有多种辅助类和多个函数调用正在取得

Helper B{ 

    // Set the attributes in here Value in here 
} 



HelperA{ 

function(){ 

    // Using the Session values 
} 
} 

我不能够涉及如何在这种情况下使用会话属性表示法

Spring框架中是否存在一个属性,用于设置会话值并可以从任何部分访问Spring应用程序 函数调用太多,改变所有方法的签名会很繁琐

回答

0

我想你可以在这个场景中使用spring bean,创建bean将它保存在http session scope 。 为此您可以找到配置here。然后在控制器中使用相同的bean。不确定的天气可以与sessionattribute注释一起使用。