aspose file tools*
The moose likes JSF and the fly likes No transition to next page from button click Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "No transition to next page from button click" Watch "No transition to next page from button click" New topic
Author

No transition to next page from button click

Russell Bateman
Ranch Hand

Joined: Feb 26, 2008
Posts: 69
I'm stumped. I have a form that allows the addition of a movie title to a catalog (database table). If the user enters a title that already exists and clicks submit, then a view page comes up with an <h:dataTable> in it that lists any other films with the same title and asks if the user wishes to add this new title. If the title is an entirely different movie that happens to share the same title with one or more already cataloged films, then the user would click to accept to add the title. Otherwise, the user would just say "Oh, it's already in the database, I don't want to add it.

On that page listing other films by the same title, I have two buttons. One adds the title to the database (and this works) and returns to the original page, cleared, ready to take the details of a new film title. The other button, the one that doesn't work, is "Don't Add This Title". The idea is also to return to the previous page form, cleared, ready to try another title.

Problem: the "Don't Add This Title" button does nothing. I don't hit my breakpoint in AddBean.clear() so, it's just sitting on the page going nowhere. Here are some excerpts from relevant code that I hope will allow you to pin-point where my brain has gone wrong:

view-one.jsp:


faces-config.xml:


AddBean.java:


Thanks in advance for considering helping me through this.

Russ Bateman
Fledgling JSF-er
Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
is your AddBean in request scope or session scope?
Russell Bateman
Ranch Hand

Joined: Feb 26, 2008
Posts: 69
Oops, I forgot to say. It's session-scoped. I tried changing AddBean to request-scoped to see what that does. It changes nothing and it breaks the behavior for when the user does want to add the title because, while it does add the duplicate title, it doesn't transition back to the addtitle.jsp page ready to type in another film.
Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
add immediate="true" to the AddBean.clear() button
Russell Bateman
Ranch Hand

Joined: Feb 26, 2008
Posts: 69
Thanks for your patience, Davie. I had tried that earlier this morning still to no avail. I only took it off to paste the samples in my question here (so as to reduce the clutter).
Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
would it work if you set type="submit"?
Russell Bateman
Ranch Hand

Joined: Feb 26, 2008
Posts: 69
I already have a "submit" button--that's the one that proceeds with adding the duplicate title.

However, I do (just now) have a solution...

Poring back through Geary/Horstmann Core JSF on <h:commandButton> for the nth time, I noted the three possible values for the type attribute got a wild hare to change it to "button". Now it works (why, who knows?) So, now I have...


view-one.jsp


Thanks very much for your help in enumerating things to try!

Best,

Russ Bateman
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: No transition to next page from button click