How to Convert Struts tags into Spring 4.0?

a 夏天 提交于 2020-01-16 19:31:07

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!