wood burning stoves 2.0*
The moose likes JSF and the fly likes Quick question about reading a Bean reading a JSF inputLabel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Quick question about reading a Bean reading a JSF inputLabel" Watch "Quick question about reading a Bean reading a JSF inputLabel" New topic
Author

Quick question about reading a Bean reading a JSF inputLabel

Kevin P Smith
Ranch Hand

Joined: Feb 18, 2005
Posts: 362
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

Joined: Mar 09, 2008
Posts: 106
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


SCJP 5, SCJD 5, SCWCD 5, SCBCD 5, SCJDWS 5
My SCBCD-Notes - My Hello World Webservice
 
Consider Paul's rocket mass heater.
 
subject: Quick question about reading a Bean reading a JSF inputLabel
 
Similar Threads
Dynamic Component in JSF
RequestDispatcher null - cant find /j_spring_security_check
bean in JSP cannot be resolved
how to add a row dynamically in panel grid by clicking on command button using jsf
Am I misunderstanding the basics of JSF 2.0?