使用jsf自动填充表单数据
我在使用JSF时遇到问题,我想为我的表单自动填充表单数据,我想输入不同的数据集(取决于用户登录) 例如: 视图:使用jsf自动填充表单数据,jsf,seam,Jsf,Seam,我在使用JSF时遇到问题,我想为我的表单自动填充表单数据,我想输入不同的数据集(取决于用户登录) 例如: 视图: <h:form id="ftextform"> <div class="region"> <s:decorate template="/pr/layout/edit.xhtml"> <ui:define name="label">Account</ui:define>
<h:form id="ftextform">
<div class="region">
<s:decorate template="/pr/layout/edit.xhtml">
<ui:define name="label">Account</ui:define>
<h:inputText id="account" value="#{fundTranferExt.account}" required="true" />
</s:decorate>
<s:decorate template="/pr/layout/edit.xhtml">
<ui:define name="label">Amount</ui:define>
<h:inputText id="amount" value="#{fundTranferExt.amount}" required="true" />
</s:decorate>
</div>
<h:commandButton id="test" value="test" action="#{fundTranferExt.setSomething}"/>
</h:form>
非常感谢您的帮助。如果您想预先填充表单,请初始化构造函数中的值。问题是什么?我没有看到。selectItems标记的
值
属性引用了fcCustomerAccounts
,但此处不存在此属性。对于maple_shaft,我已对其进行了修改,但我希望输入不同的数据集(取决于用户登录)在Seam中,您可以在用户登录后创建bean会话,另一个选项是将ifBlock移动到getter
@Name("fundTranferExt")
public class FundTranferExt implements IFundTranferExt
{
String account;
int amount;
public void setSomething()
{
// This code will not effect to view(xhtml) after executed
if(username="A"){
this.amount = 10000;
this.account= "123456";
}
else{
this.amount = 20000;
this.account= "24689";
}
}
....