2017-07-19 24 views
0

在我的登录页面上,我做了一个复选框以将数据保存到cookie。当复选框被选中时,数据将被加载到下一个打开的登录页面上的用户名字段,密码字段。目前,Cookie数据已加载到用户名字段上,但基于Tapestry page如何在Tapestry Framework中设置passwordfield的init数据?

PasswordField是TextField的一个版本,但作为元素呈现。此外,密码字段的输出值始终为空。

所以我不能设置密码字段的init数据。而且我不允许使用jquery或javascript,只需在服务器端将值设置为passwordfield即可。有人可以提出解决方案吗?

Login.tml

<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd" 
    xmlns:p="tapestry:parameter"> 
<body> 
    <t:passwordfield t:id="password" size="30" />   
</body> 
</html> 

Login.java

@Property 
private String password; 
@InjectComponent("password") 
private PasswordField passwordField;  

void setupRender() { 
password = cookieTapestry.readCookieValue("userPassword") != null ?cookieTapestry.readCookieValue("userPassword") : null; 
} 

回答

0

PasswordField就像是一个更有限的TextField。尝试< t:textfield type =“password”... >,你会发现你对行为有更多的控制。

+0

Tks鲍勃,其工作像魅力。 –

相关问题