File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes JSF 2.0 cannot rech out-come page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF 2.0 cannot rech out-come page" Watch "JSF 2.0 cannot rech out-come page" New topic
Author

JSF 2.0 cannot rech out-come page

sylvain du chatelet
Greenhorn

Joined: Aug 15, 2011
Posts: 8

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


La mesure n'est pas le contraire de la démesure! Everybody is unperfect
sylvain du chatelet
Greenhorn

Joined: Aug 15, 2011
Posts: 8

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!

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16061
    
  21

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
sylvain du chatelet
Greenhorn

Joined: Aug 15, 2011
Posts: 8

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

Joined: Jun 25, 2001
Posts: 16061
    
  21

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

Joined: Aug 15, 2011
Posts: 8

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

Joined: Aug 15, 2011
Posts: 8

Here is my Managed Bean:

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16061
    
  21

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

Joined: Aug 15, 2011
Posts: 8

Sorry i changed the name of the Class to Register but i kept the name of the managedBean to register
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16061
    
  21

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

Joined: Aug 15, 2011
Posts: 8

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

Joined: Aug 15, 2011
Posts: 8

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSF 2.0 cannot rech out-come page