如何将Struts标记转换为Spring 4.0? [英] How to Convert Struts tags into Spring 4.0?

查看:63
本文介绍了如何将Struts标记转换为Spring 4.0?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些使用Struts库的自定义代码,我们正在将其移植到Spring MVC

I have some custom code using Struts library which we are porting to Spring MVC

我需要替换

SkinTagUtils.findInScope("value1",pageContext) and

SkinTagUtils.putToScope("key", key, "page", pageContext)

进入Spring或JSP的行.

lines into Spring or JSP..

推荐答案

如果您有 pageContext 对象,则可以使用它在范围内查找变量.

If you have pageContext object then you can use it to find a variable in the scopes.

pageContext.findAttribute("value1");

或将其设置为页面范围

pageContext.setAttribute("key", key);

请注意,还有 JspContext 从指定范围检索属性,并将属性设置为指定范围.

Note, there's also other convenient methods of JspContext to retrieve an attribute from the specified scope and set attribute to the specified scope.

这篇关于如何将Struts标记转换为Spring 4.0?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆