voyent
ice:inputText values not updating properly  XML
Forum Index -> Portals & Portlets
Author Message
magruene

Joined: 20/Mar/2012 07:42:17
Messages: 18
Offline


Hello everybody,

I'm trying to develop a portlet to add, view, update and delete customers. The functionality is implemented, but I'm facing a bit of a problem.
As I said, I can view created customers in detail(eg. name, phone, fax, etc.).
I have a table which shows me every customer with a few details like the name or the creation date. I also added an edit button to every column which leads me to the detailed page, where I can edit the customer.
On initial startup of the Portlet everythings fine. I get the table with all my customers and if I want to view the detailed page of a customer, everything gets displayed correctly. The problem occurs from now onwards.
If I change to another customer(the second one since startup), the values of all textfields remain on the first viewed customer.(Like if I choose customer A with name Value ="Customer A" and other Value ="otherValueA" and switch to Customer B the values are still "Customer A" and "otherValueA").
The wierd thing is, that everything except or the inputText and inputTextField Components is updated correctly. So an custom Image or several outputLabels are updated to the new values.

Code:
<ice:outputLabel value="#{i18n['customer-website']}" />
 <ice:inputText required="true" partialSubmit="true"
 		      value="#{customersModelBean.selectedCustomer.website}" id="website" />
 <ice:outputLabel value="#{customersModelBean.selectedCustomer.website}"/>


This is just a small snippet.
The first outputLabel ist a constant, so no problem here.
The inputText gets it's value from a backing bean. On initial startup - no problem. When another customer is selected - well as I stated above - no update of the values.
The second outputLabel which gets its value from the exact same attribute of the backing bean gets updated..

Hope you guys can help.

Thanks in advance

Cheers
Marc
magruene

Joined: 20/Mar/2012 07:42:17
Messages: 18
Offline


I just found out, that if I use the h:inputText Component it works. Now I don't know whether my IceFaces Setup is messed up, which leads to that strange behaviour or thats an actual bug.

Additional info:

icefaces-ace-3.0.0
icefaces-3.0.0
icefaces-compat-3.0.0

Those are the Icefaces jars I'm using. All the other jars come with Liferay I think. I got nothing special configured, so I really have no idea why this isn't working with the Icefaces-Component. I'm fine with the h:inputText because theres no visible difference, so this problem is solved for me, but maybe it's interesting for you guys?

EDIT:

Ok, damn. I'm also using the ice:selectInputText-Component, where I can type some text an the component returns a list of possible matches. Jsf doesn't provide this Component in such an easy manner.
That said, I think I still need some help :l
philip.breau


Joined: 08/May/2006 00:00:00
Messages: 2989
Offline


It might just be that the submittedValues on the components are still overriding the values you're setting.

http://stackoverflow.com/questions/260094/jsf-getvalue-v-s-getsubmittedvalue

Try grabbing a reference to the form component and clearing the child components. They should be rebuilt before the page is re-rendered and the component state will be cleared.

Code:
 UIComponent form = FacesContext.getCurrentInstance().getViewRoot().findComponent("myForm");
 if( form != null ){
    form.getChildren().clear();
 }
 


Philip

.
magruene

Joined: 20/Mar/2012 07:42:17
Messages: 18
Offline


Thank you very much. Your code snippet and suggestion to clear the components worked like a charm. I'm back to using the Icefaces-Components now instead of the <h:> - jsf-Components. Thanks again, you guys are awesome ;)

Cheers Marc
sosarf


Joined: 19/Oct/2010 07:19:05
Messages: 18
Offline


Thanks Philip for your code snippet, you save my day ;)
happybuddha

Joined: 24/Oct/2011 15:59:19
Messages: 43
Offline


philip.breau wrote:
It might just be that the submittedValues on the components are still overriding the values you're setting.

http://stackoverflow.com/questions/260094/jsf-getvalue-v-s-getsubmittedvalue

Try grabbing a reference to the form component and clearing the child components. They should be rebuilt before the page is re-rendered and the component state will be cleared.

Code:
 UIComponent form = FacesContext.getCurrentInstance().getViewRoot().findComponent("myForm");
 if( form != null ){
    form.getChildren().clear();
 }
 


Philip 

Philip, I used this solution and it helped me. I just posted another problem that arisen after using this. Now, the page seems to have lost focus. how can I bring it back ?
My question is on : http://jforum.icesoft.org/JForum/posts/list/0/20958.page#73771
abhed

Joined: 09/Dec/2012 07:38:05
Messages: 3
Offline


magruene wrote:
Thank you very much. Your code snippet and suggestion to clear the components worked like a charm. I'm back to using the Icefaces-Components now instead of the <h:> - jsf-Components. Thanks again, you guys are awesome ;)

Cheers Marc 


I am facing a similar issue and I am new to IceFaces. I am using IceFaces 1.8. Could you please let me know, where have you added that code to clear component value.

 
Forum Index -> Portals & Portlets
Go to:   
Powered by JForum 2.1.7ice © JForum Team