简体   繁体   English

用于struts2 + spring MVC的ServletActionContext

[英]ServletActionContext for struts2 + spring MVC

I want to change this struts 2 code to spring MVC, does anyone have a clue? 我想将此struts 2代码更改为Spring MVC,有人知道吗?

HttpServletRequest request = ServletActionContext.getRequest();

I am getting this 我得到这个

org.apache.struts2.dispatcher.StrutsRequestWrappe@3535

while it hits a struts2 web app and this : 当它命中一个struts2网络应用程序时,它是:

 FirewalledRequest[ org.apache.catalina.connector.RequestFacade@2425]

while hitting a spring MVC web app. 同时点击Spring MVC网络应用。 I am a bit confused. 我有点困惑。 Any suggestions will help 任何建议将有所帮助

You can use this code to access the HttpServletRequest request in spring. 您可以在春季使用此代码访问HttpServletRequest 请求

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM