我使用JSF有麻煩自動填充表單數據,我想自動填充表單數據爲我的形式,我想輸入不同的數據集(取決於用戶登錄) 例如:與JSF
觀點:
<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>
和bean
@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";
}
}
....
任何幫助非常讚賞。
什麼問題?我沒看到一個。 – TrueDub 2011-06-09 09:29:29
您的selectItems標籤的'value'屬性引用'fCustomerAccounts',但這裏不存在。 – 2011-06-09 11:31:54
到maple_shaft,我修改了它 – 2011-06-10 01:16:13