Has anyone ever had this happen to them? You load a JSF page, and you click on a submit button, and all it does is refresh the page.
Does anyone know why that happens?
Joined: Dec 21, 2006
Hello Tammy, There can be lot of reasons for this to happen, 1. If there is no action attribute defined 2. If there are any validation errors in the page, then the action method in the bean is not invoked and just the page refreshes. 3. If Navigation is not defined in the facesConfig.xml, then the same page refreshes....
Hope this helps you...
Joined: Jan 31, 2007
thank you very much for the info.
the action is defined. when you click a button, the action is supposed to fire, and then the same page is supposed to come back with refreshed data. so i guess all that's left is maybe there's a validation error on the page. does that sound reasonable? and how would i check that?
Joined: Dec 28, 2006
Add a <h:messages /> tag to your page for displaying validation messages.
OK. I added <h:messages and there aren't any. So I'm doing some System.out's and discovered that it looks like it's doing an extra "restore view" cycle.
I'm using an SDO to talk to the database. So it calls the methods to fetch the information TWICE on the first button click, thereby resetting anything that was entered on the form. On the second button click, the method to fetch info from the database is called once, and the information entered on the form is saved.
Joined: Dec 09, 2004
Try using immediate="true" on the submit button. If it works then probably it has something to do with validations.
Are there any valueChangeListeners on the page? if yes, try adding Sysouts there, Also check if FacesContext.responseComplete is being invoked anywhere in bean?
Display names must be two words: your first name, a space, then your last name. Fictitious names are not allowed.
Please edit your profile and correct your display name since accounts with invalid display names get deleted, often without warning
Joined: Jan 31, 2007
Thanks, everyone, for your help. I did try immediate="true" on the submit button. That didn't work. Everyone who mentioned validations was correct. As soon as I added a numeric validation to the fields I was trying to capture it was fine. I think JSF goes through the validations phase whether you are doing error checking or not. If you are *not* doing error checking, it will hit this phase and refresh the page on you. Good to know.