Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Quick question about reading a Bean reading a JSF inputLabel

 
Kevin P Smith
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a registration page which forwards to a confirm page, how can I get my RegistrationBean to grab the values of my outputLabels

example:-
<h: outputText value="#{reg.email}" />

@managedBean(name="reg"
...

private String email
getEmail/setEmail

I keep getting 'null', so I guess I shouldn't be using a h: outputText, but what should I be using?
The only other thing I can think to do is add a inputHidden for each param in my confirmation page:
e.g: <h:inputHidden name="email" id="email" value="#{reg.email}" />

Saying that, why has my Bean lost the values for firstname, surname etc yet it is able to display them in the JSF page?

Here is the code for viewing:-

Enter Details page:


Confirm page:


Bean:


Cheers

KS
 
Christian Nicoll
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Keith,

I have't use facelets much and I don't know nothing about the FacesContextManager (class/interface ? - Do you have further infos?), but I would assume that the forward and/or redirect method of FacesContextManager can be a problem.

I had assumed that you return a String in your confirm()-method and then over the specific navigation-rule in your faces-config.xml do the forward to your result page. Why don't you use this common approach?

You 've bind your bean "reg" only on the request-scope. I'm not sure that this FacesContextManager takes care that your request-values from your input page are also available in your result page. You can also try it out to bind your managed bean at the session scope, does you still get a null value?

Best regards,
Christian
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic