Help coderanch get a
new server
by contributing to the fundraiser
  • 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

Nested Backing Bean

 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi all,

I have a issue with populating backing bean details.

a) I have customer jsf, which is backed by customer.bean (request scope), this bean has a reference to result.bean (which has the results of the credit card validation, let us say approved (allowable yes/no).

Customer class

String name;
String userId;
Result result;

public String validateCustomer() {
//biz logic
result = new Result();
result.setApproved(Y/N);
return "mapping" (result.jsf)
}
on the result.jsf
<h:outputFormat styleClass="outputText" value="#{msg.outputpgdisp}">
<f:param value="#{result.approved}"></f:param>
</h:outputFormat>

This always gives null, can i know which i am facing this issue.
both the backing bean are request scope

Thanks
 
Saloon Keeper
Posts: 27929
198
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
I think you should have been saying:



Otherwise JSF will construct a whole new Result bean separate from the one in the Customer bean - unless you injected it into the Customer bean as a managed property.

Request-scope objects have a very short lifetime, though, so it's best when you're unsure or have problems to use session scope. Then when everything's working you feel brave, you can change the scope.
 
Proudly marching to the beat of a different kettle of fish... while reading this tiny ad
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic