2014-06-18 25 views
0

我想將這個struts 2代碼改成spring MVC,有沒有人有線索?struts2 + spring MVC的ServletActionContext

HttpServletRequest request = ServletActionContext.getRequest(); 

我得到這個

[email protected] 

同時擊中一個Struts2的Web應用程序 這:

FirewalledRequest[ [email protected]] 

同時擊中一個Spring MVC的Web應用程序。 我有點困惑。 任何建議將幫助

+0

您是否需要在spring mvc中獲取HttpServletRequest? –

+0

是的,但它給了我FirwallledRequest [..]我不知道那是什麼。 – wintersam

+0

哪個包裝類? –

回答

1

您可以使用此代碼在春季訪問HttpServletRequest請求

ServletRequestAttributes attr = (ServletRequestAttributes) 
           RequestContextHolder.currentRequestAttributes(); 
HttpServletRequest request = attr.getRequest(); 
+0

謝謝,我現在就試試。 – wintersam

+0

工程就像一個魅力!謝啦! – wintersam

+0

很高興它解決了你的問題..! –