• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

first button click reloads page

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...

-Rajani
 
Tammy Easterby
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi rajani,

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?

- tammy
 
Ranch Hand
Posts: 893
Tomcat Server Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Add a <h:messages /> tag to your page for displaying validation messages.
 
Tammy Easterby
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

Any ideas?
 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?

Hope it helps.

Ravindra
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Ravindra",

This is your third and last request to fix your display name.

We're a friendly group, but we do require members to have valid display names.

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

thanks,
Dave
 
Tammy Easterby
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

Thanks again, everyone.
 
We're being followed by intergalactic spies! Quick! Take this tiny ad!
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic