How do you concatenate a session variable string with another string
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"/>
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
property_one = "you ran {0} miles today"
And then in the JSP you do this:
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<bean:message key="property_one" arg0="${sessionScope.miles}"/>
精彩评论