替换Struts2标签中的一部分字符串 [英] Replace part of a string in a Struts2 tag

查看:181
本文介绍了替换Struts2标签中的一部分字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以替换Struts2中的属性值? 我想解析一个mimetype图像,做这样的事情真的很有用:

Is it possible to replace the value of a property in Struts2? I want to resolve a mimetype image, and it would be really useful to do something like:

<img src="<s:property value='%{mimetype.replace("/", ".")}'/>" ...

我可以像这样在飞行中做些什么吗?

Can I do something on the fly like this?

谢谢!

推荐答案

<img src="<s:property value='%{mimetype.replace("/", ".")}'/>

是的,ognl可能允许直接使用字符串方法

Yes it's possible ognl allows to use string mehthods directly

这篇关于替换Struts2标签中的一部分字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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