Topic: 寻求Tapestry中文解决之道

  Print this page

1.寻求Tapestry中文解决之道 Copy to clipboard
Posted by: leafgray
Posted on: 2004-09-14 11:16

现在发现,在Tapestry里的中文问题很让人郁闷.....
在page,jwc里不能有中文......

谁有办法解决?快死了...

<component id="inputUserName" type="ValidField">
  <static-binding name="displayName" value="用户名"/>
  <binding name="value" expression="id"/>
  <binding name="validator" expression="beans.validator"/>
</component>

<component id="inputPassword" type="ValidField">
  <static-binding name="displayName" value="密码"/>
  <binding name="value" expression="password"/>
  <binding name="validator" expression="beans.validator"/>
<binding name="hidden" expression="true"/>
</component>

密码可以存在,用户名就不对了......

2.Re:寻求Tapestry中文解决之道 [Re: leafgray] Copy to clipboard
Posted by: lcwling
Posted on: 2004-09-14 22:46

Don't forget Using Tapestry’s localization features:

Tapestry applications allow for localization of both text and images. Localized strings can be easily referenced in the HTML template, both for inclusion as part of the static portion of the page and as values bound to component parameters. Images (or really,any kind of asset) are also automatically localized.
These localized messages are stored in a set of properties files for the page. The properties files are stored in the WEB-INF folder of the web application, alongside the page specification.

for example,my.page/jwc

<component id="inputUserName" type="ValidField">
<message-binding name="displayName" key="User-Name"/>
<binding name="value" expression="userName"/>
<binding name="validator" expression="beans.validator"/>
</component>


my_zh_CN.properties

User-Name=\u7528\u6237
..................................

有段时间没有coding,Tapestry也有些生疏了,还是忍不住想回答你的问题,只是没有时间查看与之对应的Tapestry source code,你可以自己了解一下,真羡慕你有这样的学习环境!

3.Re:寻求Tapestry中文解决之道 [Re: leafgray] Copy to clipboard
Posted by: leafgray
Posted on: 2004-09-16 15:38

谢谢楼上的热心帮助......

学得我都有点灰心了......

总是找不到感觉......

再问个问题:
tapestry 的component 能各个页面共享吗?

4.Re:寻求Tapestry中文解决之道 [Re: leafgray] Copy to clipboard
Posted by: heaven
Posted on: 2004-09-17 00:26

最近刚开始关注tapestry,不知道tapestry能不能支持页面事件的组件化编程,简单说就是将javascript的事件包装进组件

5.Re:寻求Tapestry中文解决之道 [Re: heaven] Copy to clipboard
Posted by: lcwling
Posted on: 2004-09-17 01:13

heaven wrote:
最近刚开始关注tapestry,不知道tapestry能不能支持页面事件的组件化编程,简单说就是将javascript的事件包装进组件


js无法包装在Tapestry component,component只能定义或包装静态属性,对于事件只能定义在页面中!
for example:

<form jwcid="@Form" onSubmit="return checkValues();" id="form1">

6.Re:寻求Tapestry中文解决之道 [Re: leafgray] Copy to clipboard
Posted by: lcwling
Posted on: 2004-09-17 01:20

leafgray wrote:
学得我都有点灰心了......

总是找不到感觉......

学以致用!

再问个问题:
tapestry 的component 能各个页面共享吗?

不大明白你所谓共享的意义,如果自定义了component,就可以在各个页面中使用!

7.Re:寻求Tapestry中文解决之道 [Re: leafgray] Copy to clipboard
Posted by: leafgray
Posted on: 2004-09-17 08:20

我的意思是说,在一个page里定义了一component.

那在别的页面里还能用这个组件吗??

问题很多,我现在有一个组件,它包含了一个有多个属性和方法的对象.....
我能动态的取出每个属性并对其进行格式化输出吗?
大概像这样:
<parameter name="myObject" type="MyObject" />
<parameter name="property" type="String" />

通过对property赋不同的值,得到myObject的不同属性,并格式化(如截长等)
不同的属性格式可能不一样......

感觉很难做到,因为一个id只能用一次...


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923