voyent
basic problem with displaying  XML
Forum Index -> General Help
Author Message
ext920

Joined: 02/Jul/2008 00:00:00
Messages: 7
Offline


Hi, I don't know what I'm doing wrong. But I have controller:


public class TestingController {
private String name;
public String submit() {
setName("newName");
return null;
}
public void setName(String name) { this.name = name;}
public String getName() { return name; }
}


--------and view:
Code:
 <ice:inputText id="inp" value="#{testController.name}" />
 

Code:
 <ice:commandButton id="submit" value="SUBMIT" action="#{testController.submit}"  />
 

When I submit the form after first displaying the page..the input is set to newName, next I clear the inputText to "". and submit again but the name is not set to newName again as I would expect but it's empty.

Can you help with this? //isn't it something with saving state?
thank you in advance.
mgroeneweg

Joined: 26/Dec/2008 00:00:00
Messages: 238
Offline


I think the submit button action is handled before the property change.
So the submit button does it's work, but it gets overwritten because you also changed the input field value.
Maybe set the immediate flag of the button to true?
ext920

Joined: 02/Jul/2008 00:00:00
Messages: 7
Offline


Unfortunately immediate="true" doesn't help.
mgroeneweg

Joined: 26/Dec/2008 00:00:00
Messages: 238
Offline


This is from the top of my head as I have no currently no time to try it myself, but this helped me with a similar issue, but with a row selector
Please remove the immediate attribute and try this one:

Code:
		if (!e.getPhaseId().equals(PhaseId.INVOKE_APPLICATION)) {
  			e.setPhaseId(PhaseId.INVOKE_APPLICATION);
  			e.queue();
  			return;
  		}


Replace e with the variable passed in with the button event.
edykory


Joined: 27/Nov/2006 00:00:00
Messages: 332
Offline


@mgroeneweg - you are a little bit off topic in this case
1. I checked the problem in detail: it really happens and I'm almost sure there's a little bug in the IceFaces server side diff composer; more specifically, the value get's set on the bean correctly, but the updates are not sent back to the client.
2. The method ext920 is using is an "action", and that happens in "Invoke Application" anyway (if immediate is not used, of course), and also there's no e object :).
3. Your solution is for this case: you have a ValueChangeListener (which is called before "Update Model" or an "ActionListener" + immediate="true") and want to change some values which would be overwritten by the "Update Model" phase => you move the listener execution to "after Update Model", that is "Invoke Application"

I made a more laborious comment on the behavior here: http://www.icefaces.org/JForum/posts/list/11581.page#46496
ext920

Joined: 02/Jul/2008 00:00:00
Messages: 7
Offline


Hi thank you for your entry, have you found any workaround? How have you solved that in some way?
ext920

Joined: 02/Jul/2008 00:00:00
Messages: 7
Offline


I've found some workaround which doesn't put my controller into the session. In my method, I find particular component manualy and set the value. But it's not nice.
edykory


Joined: 27/Nov/2006 00:00:00
Messages: 332
Offline


You didn't get me. putting the controller in the session was not in order to solve the problem, but to simulate icefaces' "extendedRequestScope".

Of course, the easy workaround is to bind that control to an HtmlInputText and call
Code:
 i.setLocalValueSet(false);
 i.setValue(null);
 i.setSubmittedValue(null);
 

or, if you have more controls on your form, bind your form and use :
Code:
 	public static void forceRefresh(UIComponent parent) {
 		for (UIComponent c: parent.getChildren()) {
 			if (c instanceof UIInput) {
 				UIInput i = (UIInput) c;
 				i.setLocalValueSet(false);
 				i.setValue(null);
 				i.setSubmittedValue(null);
 			}
 			forceRefresh(c);
 		}
 	}
 

It looks like a lot of processing, but I profiled it and on a middle form (about 10 different input controlls) it takes 0 milliseconds according to System.currentTimeMillis


Eduard
ext920

Joined: 02/Jul/2008 00:00:00
Messages: 7
Offline


I've tried your solution and it didn't work. in method
which is invoked in UPDATE_MODEL_VALUES before framework reset my value back to "".

tried to put my binded UIForm to your method or to get UIViewRoot from the FacesContext.
mgroeneweg

Joined: 26/Dec/2008 00:00:00
Messages: 238
Offline


@edykory: I stand corrected!! :blush:

Now I better understand the issue. I also read your post.
Actually, I did run into something similar with input text with empty values.
However, I could not clearly identify what was happening, but you did.
So let's see what ICEfaces.org makes of your analyses.
edykory


Joined: 27/Nov/2006 00:00:00
Messages: 332
Offline


ext920 wrote:
I've tried your solution and it didn't work. in method
which is invoked in UPDATE_MODEL_VALUES before framework reset my value back to "".

tried to put my binded UIForm to your method or to get UIViewRoot from the FacesContext. 

Hi!

Yes, I also checked and it doesn't work. Let's hope the bug gets fixed some day soon.

But the code snippet is very useful so keep it. You'll need it if you change model values in an actionListener method or action method on a control marked with immediate=true (like a "delete" button or an "edit" commandLink in datatable when details have invalid info) or if you're trying to change values bound to controls from another form on the same page (like in master/detail scenario)

Eduard
ext920

Joined: 02/Jul/2008 00:00:00
Messages: 7
Offline


Hi, yes method is quite inspiring walking the tree and reseting values :). thank you anyway
mgroeneweg

Joined: 26/Dec/2008 00:00:00
Messages: 238
Offline


@edykory: I took your static method too.
It fixed my problem too. After the user pressed a button with immediate=true, old values would appear on the detail panel when the user clicked the next item in the dataTable for editing in the detail panel.

Nice one! :cool:
edykory


Joined: 27/Nov/2006 00:00:00
Messages: 332
Offline


@ext920
The problem doesn't manifest anymore in IceFaces 1.8.0 RC1 (I didn't check with the DR releases). In JIRA it looks like it was a problem in the Bridge when applying the diff to the current page .

http://jira.icefaces.org/browse/ICE-3945 (read Mark Collette's posts)

Eduard
michelle2

Joined: 14/Nov/2007 00:00:00
Messages: 449
Offline


edykory wrote:
@ext920
The problem doesn't manifest anymore in IceFaces 1.8.0 RC1 (I didn't check with the DR releases). In JIRA it looks like it was a problem in the Bridge when applying the diff to the current page .

http://jira.icefaces.org/browse/ICE-3945 (read Mark Collette's posts)

Eduard 


Are you sure this is fixed in 1.8 . We are seeing something similar.

Put three inputtextboxes inside a panel grid, the value of box 3 can manually be set by the user or is calculated from inputextbox 1 and 2 after a button is clicked. Immediate=true is not set on the button , clicking the button the new value appears briefly in box 3 than is replaced by 0 which was the old value.

Checking in debugger watching htmlinputText, inpututtextrender and baseRender it looks like the value coming in is the empty "".

There also numerous focus problems .

Just tabbing through a number of empty textboxes with custom converters (I can't see any major difference between the standard converterr and the custom converter.
in the app, both problems exist in 1.8 ga but only the submitted value issue shows up in 1.72, everything works just fine in 1.70. Also it looks like there major changes to focus.js, I tried modifying that but although I fixed the issue I also broke the onBlur event. I'm analysing the bridge code between 1.72 and 1.80 to see if i can find the issue. Makes it hard because after you change any of this js, you have to rerun the ant build to get the new compressed bridge file.

[Email]
 
Forum Index -> General Help
Go to:   
Powered by JForum 2.1.7ice © JForum Team