• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSF 2.0 cannot rech out-come page

 
Greenhorn
Posts: 8
Netbeans IDE MySQL Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello guys,

I have a problem on my JSF 2.0 web application! [Java EE6, GlassFish 3.1]
when i click on the commandButton it seems that the managed bean is blocked on validator methods i cannot go to the next page (the outcom). I have definition of navigation rules and Managed Bean declared in xml faces-confi and all the stuff but it does not work correctly

here is the code
The submit button

I tried action=#{register.nextPage} wich returns always register2 but noway!

Here is one field of the h:form




Please help me to find out how to "validate" the validation process and go to the next page

Without the validators everything works quiet good!

thank you in advance
 
sylvain du chatelet
Greenhorn
Posts: 8
Netbeans IDE MySQL Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
when I specified the attribute immediate="true" for the commandButton the action is performed and it goes to the next page but the request did not pass the parameters it returns nothing! even if i changed the scope annotation from request to session no way!

 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Sylvain!

"immediate=true" is what you code to tell JSF to fire the command action without updating (or validating) any of the form data. A good use, for example, would be on a "Cancel" button where the user wants to discard all entered data and go to some other page.

JSF requires that all data submitted be valid. If even one item is invalid, the entire process is blocked. You can add an "<h:messages>" element to your page to see the validation failure messages. Note that the "messages" element is not the same thing as the "message" element, which only shows messages for a specific control.
 
sylvain du chatelet
Greenhorn
Posts: 8
Netbeans IDE MySQL Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Tim ,

Tim Holloway wrote:Welcome to the JavaRanch, Sylvain!

JSF requires that all data submitted be valid. If even one item is invalid, the entire process is blocked. You can add an "<h:messages>" element to your page to see the validation failure messages. Note that the "messages" element is not the same thing as the "message" element, which only shows messages for a specific control.



I have already a <h:messages/> element with 3 different SEVERITY and no ERROR and/or FATAL are signaled!
Only INFO and/or WARN messages. That's why i don't see why the validation will fail!?
 
Tim Holloway
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It would help if you actually listed the messages. Just because they're not "ERROR" doesn't mean that the form is considered valid.
 
sylvain du chatelet
Greenhorn
Posts: 8
Netbeans IDE MySQL Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
They are custom messages coming from my custom validators.

Later in the evening I'll post the code of my Managed Bean which contain the validators and all the stuff.
 
sylvain du chatelet
Greenhorn
Posts: 8
Netbeans IDE MySQL Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is my Managed Bean:

 
Tim Holloway
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your managed bean is registered to JSF under the name "Register". You're referring to it in your View definition as "register". Java is case-sensitive.

It's actually not a good idea to assign initial capitalization to a bean name, since it's an instance, not a class, and initial caps conventionally mean class names. In fact, if you don't provide a "name=" on your annotation, JSF will automatically lower-case the first letter of the classname and use the resulting name to register your backing bean.
 
sylvain du chatelet
Greenhorn
Posts: 8
Netbeans IDE MySQL Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry i changed the name of the Class to Register but i kept the name of the managedBean to register
 
Tim Holloway
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you register a JSF backing bean with both an attribute and an entry in faces-config, the faces-config will take precedence. Which would have negated the problem with your annotation except that your actual classname in faces-config was violating the other side of the coin: classname should begin with an initial capital letter.

When JSF cannot resolve a backing bean name, typically it will ignore the associated property or action and not report it as an error.
 
sylvain du chatelet
Greenhorn
Posts: 8
Netbeans IDE MySQL Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Excuse me Tim this is just because i changed manualy on the code I posted then I changed the name of the Class only on my own project
Class: Register
managedBean: register
action: #{register.register2}

 
sylvain du chatelet
Greenhorn
Posts: 8
Netbeans IDE MySQL Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I found the problem and then the solution:

In the case that my validator message is:

or

I must not throw a new Exception:

Simply because it will be considered as an exception and then the validation process will fail!

The only problem now is that i cannot tell the user much about warning message, for exemple when his password is not enough secure or weak at all!
But I can use those INFO and WARN messages as parameters to pass them throw request and then display them under the next page
 
reply
    Bookmark Topic Watch Topic
  • New Topic