IntelliJ Java IDE
The moose likes JSF and the fly likes commandButton immediate = Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "commandButton immediate = "true"...." Watch "commandButton immediate = "true"...." New topic
Author

commandButton immediate = "true"....

Zein Nunna
Ranch Hand

Joined: Mar 31, 2005
Posts: 245
Hi guys

I had a problem where, when you clicked a button the page refereshed rather than direct me to some other page.

I went here, realised we had the same problem, so I used 'immediate = "true"' in my <h:commandButton> tag, it did the trick and started forwarding me to the right page, however lacking the data from input fields.

What I want to know is what is the function of the immediate = "true"? does it skip validation/instatiation of the bean and go straight to some page?

Any other information you have on this please let me know.

Thnanks in advance fot your thoughts,
Regards
Zein
Gabriel Claramunt
Ranch Hand

Joined: May 26, 2007
Posts: 375
Setting immediate="true" just skips the validation step, that's why you're redirected without validations. Probably you have a validation error...


Gabriel
Software Surgeon
Zein Nunna
Ranch Hand

Joined: Mar 31, 2005
Posts: 245
Thank you Gabriel.
Zein Nunna
Ranch Hand

Joined: Mar 31, 2005
Posts: 245
Just a follow up to this, question/problem. Why is it that the logs dont show validation erorrs on JSF?? Is there anyway of getting the errors to be shown, like a jar or something?

Thanks in advance
Zein
Gabriel Claramunt
Ranch Hand

Joined: May 26, 2007
Posts: 375
Originally posted by Zein Nunna:
Just a follow up to this, question/problem. Why is it that the logs dont show validation erorrs on JSF?? Is there anyway of getting the errors to be shown, like a jar or something?

Thanks in advance
Zein


Validation errors are meant to be shown in the screen so the user can correct them. (but yes, is kind of disturbing when everything looks ok, but your page is just refreshed instead of redirected)
While working with JSF, I found useful to add a "<h:messages ... >" tag to display all the errors.
Tak Ng
Greenhorn

Joined: Jun 05, 2007
Posts: 19
The attribute immediate set to "true" is commonly used when you want to cancel a form. In any other case, you should not activate immediate as it skips validation.
Zein Nunna
Ranch Hand

Joined: Mar 31, 2005
Posts: 245
Thanks guys for your reponses so far,

Gabriel, Can you post an example of how you've used <h:message...> to show you validations errors.

I missed <h:column> tags in one of my test pages and the whole thing wouldn't work with no indication of what the error was. Needless to say after hours or trying a billion combinations I hit the jackpot.

In essence this is what my problem is i.e. if I miss a tag or something I want it to say 'Hey you no <h:column> tags found...blah blah'.

Thanks in advance.
Regards
Zein
Gabriel Claramunt
Ranch Hand

Joined: May 26, 2007
Posts: 375
the <h:messages> tag will display all the validation errors for the components in the page.
I remember too being in the situation of having a missing tag and nothing working
 
 
subject: commandButton immediate = "true"....
 
Threads others viewed
keep the values of my input text fields
Trinidad commandButton needs clicked twice to fire bean
Two simple UI headaches
JSF: simple "required" validation problem
Hard days with a rich:tabPanel inside a h:form
MyEclipse, The Clear Choice

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture