如何将会话变量字符串与另一个字符串连接
假设我的属性文件中有以下内容:
property_one = "you ran 5 miles today"
目前我的 jsp 文件显示此属性,
我想替换 5
并使其动态。因此,假设我有一个变量在会话中保存该值。
在我的 JSP 文件中,我将如何进行串联?
我的计划是更改我的属性文件:
property_one = "you ran"
property_two = "miles today"
但是我不知道如何将它们与会话变量连接起来。
编辑:当前代码
<c:set var="runMessage"><bean:message bundle="RUN_MESSAGE" key="property_one"/>
So say I have the following in my properties file:
property_one = "you ran 5 miles today"
Currently my jsp file displays this property
I would like to substitute out the 5
and make it dynamic. So assume I have a variable holding this value in the session.
In my JSP file, how would I do the concatenation?
My plan is to alter my properties file:
property_one = "you ran"
property_two = "miles today"
However I don't know how to concatenate these with a session variable.
EDIT: current code
<c:set var="runMessage"><bean:message bundle="RUN_MESSAGE" key="property_one"/>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 Struts 1 中,您使用 bean 消息标签从 ResourceBundle 中读取。如果您想要动态消息,请放置占位符。示例:
mymessages.properties
然后在JSP中执行以下操作:
In Struts 1 you use bean message tag to read from the ResourceBundle. If you want to have a dynamic message you put placeholders. Example:
mymessages.properties
And then in the JSP you do this: