问题
I have some custom code using Struts library which we are porting to Spring MVC
I need to replace
SkinTagUtils.findInScope("value1",pageContext) and
SkinTagUtils.putToScope("key", key, "page", pageContext)
lines into Spring or JSP..
回答1:
If you have pageContext
object then you can use it to find a variable in the scopes.
pageContext.findAttribute("value1");
or set it to the page scope
pageContext.setAttribute("key", key);
Note, there's also other convenient methods of JspContext to retrieve an attribute from the specified scope and set attribute to the specified scope.
来源:https://stackoverflow.com/questions/24432099/how-to-convert-struts-tags-into-spring-4-0