我在项目中使用了scope="session"和scope="request"
使用的前台是struts但是老是出现错误:
No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.后来我在web.xml里加了
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
不起作用又试了
<filter>
<filter-name>requestContextFilter</filter-name>
<filter-class>org.springframework.web.filter.RequestContextFilter</filter-class>
</filter><filter-mapping>
<filter-name>requestContextFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
还是不起作用
还是那个错误
(就是scope="session"和scope="request"的问题,如果把scope全部改成"singleton"或者"prototype"是没有问题的)
使用的前台是struts但是老是出现错误:
No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.后来我在web.xml里加了
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
不起作用又试了
<filter>
<filter-name>requestContextFilter</filter-name>
<filter-class>org.springframework.web.filter.RequestContextFilter</filter-class>
</filter><filter-mapping>
<filter-name>requestContextFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
还是不起作用
还是那个错误
(就是scope="session"和scope="request"的问题,如果把scope全部改成"singleton"或者"prototype"是没有问题的)
多线程调用时实例化多个对象和使用单例
如果设置成request或者session的话,肯定不匹配相应的schemal或者DTD文件,所以会出现错误
不要说没有session,request
那是N年前的事了