读书人

国际化中占位符的运用

发布时间: 2012-11-05 09:35:11 作者: rapoo

国际化中占位符的使用

占位符 这个大家应该都知道,所有下面主要说下,它的写法及页面上的使用方式

?

?

首先在struts2中 我们先配置 k-v

?

在? xxx.properties?

?

pub.login.required = {0} is required.
pub.login.name = 名字 

?

?

页面的使用 1 .? 使用 <s:param > 标签传参

?

alert('<s:text name="pub.login.required "><s:param>                      <s:text name="pub.login.name"/>              </s:param>         </s:text>');

?表示:名字是必须的.

?

或者? 2 .?在?getText 中 使用大括号

?

alert("<s:property value="getText('pub.login.required ',{getText('pub.login.name')})"/>");

?其实上面的 getText 好像就是strtus2 action 的方法

?

下面贴出 <s:property >的其他用法

?

请看下面童鞋的 ,比较清晰.

http://zmx.iteye.com/blog/554986??? Struts2 标签使用简介

?

?

还有 ognl表达式的详细介绍

?

http://zmx.iteye.com/blog/553748??

?

?

读书人网 >软件架构设计

热点推荐