Perhaps I haven't described my problem exactly so that it's unterstandable...
My problem is the following:
If I add a Binding attribute to a inputText component, I can't update the value of this Textfield by an ValueChangeEvent of another InputText Component.(if the Page is new loaded, the inputTextfield is still empty=
If I try to set the value with the appropriate setter method, just nothing happens. The inputtext field stays empty and the value isn't updated.
When I remove the Binding attribute then everything works... (But I need the binding)
Do I have to set the value in another way?
Regards,
Andy
-----Ursprüngliche Nachricht-----
Von: Mitter Andreas, ISX
Gesendet: Donnerstag, 26. Januar 2006 14:10
An: MyFaces (E-Mail)
Betreff: Problems with ValueChangeEvent and ValueBinding
Hi all!
In my application I have a inputText Component with a ValueChangeEvent.
The ValueChangeMethod starts a Database query and if some data is found, then the founded records are written into other inputText Components on the mask.
The problem now is, that if I add a ValueBinding attribute to this other inputText fields, the new data from the query isn't written into the fields. If I remove the Valuebinding everything works...
How can I overcome this problem?
Here my jsp with two InputText Fields
<t:htmlTag value="td" rendered="#{showTags.showLfnr}">
<h:inputText binding="#{beziehungsDto.ITlfnr}" id="lfnr"
value="#{beziehungsDto.lfnr}" styleClass="mustfield" required="true"
size="35" rendered="#{showTags.showLfnr}" immediate="true"
valueChangeListener="#{querySelectHelper.selectSamData}"
onchange="submit()">
<f:validateLength maximum="35"></f:validateLength>
</h:inputText>
</t:htmlTag>
In this second field some data should be written. If I remove the binding attribute, it works, if I leave it, the field isn't updated...
<t:htmlTag value="td">
<h:inputText binding="#{beziehungsDto.ITpartnername}" id="partnernameneu" value="#{beziehungsDto.namepartner}"
styleClass="mustfield" required="true" size="35">
<f:validateLength maximum="35"></f:validateLength>
</h:inputText>
</t:htmlTag>
Here is the ValueChangeMethod:
public void selectSamData(ValueChangeEvent event)
{
beziehungsDto = (BeziehungDto)FacesUtil.getManagedBean("beziehungsDto");
qh = (QueryHelper)FacesUtil.getManagedBean("queryHelper");
Session session = HibernateSAMUtil.currentSession();
Transaction tx = null;
try {
tx = session.beginTransaction();
String sqlstring = "Select a.firmNr, a.firmNamKurz, a.bdtKndNr," +
" a.lfvUebArt, a.sfDunsNr from Eklist a where a.firmNr=:liefnr";
Query q =session.createQuery(sqlstring);
q.setString("liefnr", (String)event.getNewValue());
Iterator it = q.list().iterator();
while(it.hasNext())
{
Object[] row = (Object[])it.next();
//beziehungsDto.setNamepartner((String)row[1]);
beziehungsDto.getITpartnername().setValue((String)row[1]);
beziehungsDto.setNamepartner((String)row[1]);
...
}
}
String viewId = "/popupAddBeziehung.jsp";
FacesContext context = FacesContext.getCurrentInstance();
UIViewRoot view = context.getApplication().getViewHandler()
.createView(context, viewId);
view.setViewId(viewId);
context.setViewRoot(view);
context.renderResponse();
tx.commit();
}
catch (Exception ex) {
if (tx != null)
tx.rollback();
MessageUtils.addMessage(FacesMessage.SEVERITY_WARN,
"errorListDataForAdminDB", null, context);// TODO
ex.printStackTrace();
}
finally {
HibernateSAMUtil.closeSession();
}
}
______________________________________________________________________ This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify your system manager. This footnote also confirms that this email message has been swept for the presence of computer viruses. ______________________________________________________________________

