关于struts中bean:message key的使用问题?

04-02-26 happycpa

prompt.welcome=Welcom <font color="red">{0}</font> to here!

在jsp中用bean:message,用户名在UserBean的uname中,怎么动态调用?

<bean:message key="prompt.welcome" arg0=" (这里怎么写) "

rypan
2004-02-27 10:17

arg0属性

happycpa
2004-02-28 10:38

bean:message key="" arg0="这里要动态,不用%形式怎么做?"

happlyin
2004-03-02 16:05

MessageResources mr = MessageResources.getMessageResources("参数");
参数 表示messages resources的名字

mr.getMessage("prompt.welcome",obj);

obj替换{0}

happlyin
2004-03-02 16:09

jsp页面中
bean:message key="" arg0="" arg1="" ....
这些arg0,arg1本身就是动态的。
我不知道你还需要什么动态

happycpa
2004-03-03 09:57

在session中有个UserBean叫userbean,它有个属性叫UserName,
下面这么写对吗?

<bean:write key="prompt.welcome" arg0="userbean.userName"/>

<p class="indent">