seam valueChangeListener
nicevision2020 Aug 18, 2009 9:50 PMHi
Could you please tell me what i am doing wrong here. Whenever i change the drop down the textbox is not changed with new value. because of this whenever i change the drop down it updates the table from the textbox.
xhtml page...
'<ice:selectOneListbox id="accounts"
value="#{accountManagerService.selectedAccount}" size="1"
valueChangeListener="#{accountManagerService.accountChanged}"
partialSubmit="true" required="true">
<s:selectItems value="#{findAllActiveAccounts}" var="account"
label="#{account.description}" />
<s:convertEntity />
</ice:selectOneListbox>'
'<ice:inputText styleClass="freeFormInput" id="description"
value="${accountManagerService.selectedAccount.description}" required="true" />'
AccountManager.java
@Scope(ScopeType.CONVERSATION)
@Name("accountManagerService")
@AutoCreate
@Restrict("#{identity.loggedIn}")
public class AccountManager implements java.io.Serializable {
@In
private EntityManager entityManager;
private Account selectedAccount;
public void accountChanged(ValueChangeEvent evt) {
if (!evt.getPhaseId().equals(PhaseId.INVOKE_APPLICATION)) {
evt.setPhaseId(PhaseId.INVOKE_APPLICATION);
evt.queue();
return;
}
if (evt.getNewValue() != null) {
entityManager.flush();
FacesContext.getCurrentInstance().getResponseComplete();
selectedAccount = (Account) evt.getNewValue();
}
FacesContext.getCurrentInstance().responseComplete();
}
When the page loades from the s:link it sets the description after everychange there is no change in description.
1. How do i refesh the description from the selectedAccount.
2. I think because of not changing the description seam think the object is dirty.
Thanks in advance
Could you please tell me what i am doing wrong here. Whenever i change the drop down the textbox is not changed with new value. because of this whenever i change the drop down it updates the table from the textbox.
xhtml page...
'<ice:selectOneListbox id="accounts"
value="#{accountManagerService.selectedAccount}" size="1"
valueChangeListener="#{accountManagerService.accountChanged}"
partialSubmit="true" required="true">
<s:selectItems value="#{findAllActiveAccounts}" var="account"
label="#{account.description}" />
<s:convertEntity />
</ice:selectOneListbox>'
'<ice:inputText styleClass="freeFormInput" id="description"
value="${accountManagerService.selectedAccount.description}" required="true" />'
AccountManager.java
@Scope(ScopeType.CONVERSATION)
@Name("accountManagerService")
@AutoCreate
@Restrict("#{identity.loggedIn}")
public class AccountManager implements java.io.Serializable {
@In
private EntityManager entityManager;
private Account selectedAccount;
public void accountChanged(ValueChangeEvent evt) {
if (!evt.getPhaseId().equals(PhaseId.INVOKE_APPLICATION)) {
evt.setPhaseId(PhaseId.INVOKE_APPLICATION);
evt.queue();
return;
}
if (evt.getNewValue() != null) {
entityManager.flush();
FacesContext.getCurrentInstance().getResponseComplete();
selectedAccount = (Account) evt.getNewValue();
}
FacesContext.getCurrentInstance().responseComplete();
}
When the page loades from the s:link it sets the description after everychange there is no change in description.
1. How do i refesh the description from the selectedAccount.
2. I think because of not changing the description seam think the object is dirty.
Thanks in advance