Thanks for your quick reply, Simon!
 
I have something like following
 
public class A {
   
   public void changeChoices(ValueChangeEvent event)  {
      // Gets the car from the cars list
 
      // Updates the myCar instance to be selected car.
    
   }
 
   public update () {
        System.out.println(myCar.getId());
        System.out.println(myCar.getName());
 
        ...
   }
 
   public MyCar getMyCar() {
        return myCar;
   }
 
   private MyCar myCar = new MyCar();
   private Cars    cars   = new Cars();
 
}
 
Where
      myCar = new MyCar();
      cars = new Cars();
 
Instantiates objects and gets data from database. Both have been defined as the managed bean and put in the session scope.
 
I have another class
 
public class B extends A {
     public create () {
          System.out.println(getMyCar().getId());
    }
}
 
In the jsp page I have something like:
 
<h:form>

<

h:selectOneMenu id="profiles"  value="#{a.myCar.id}"

onchange="document.myForm.submit()"

valueChangeListener="#{a.changeChoices}"

immediate="false">

<f:selectItems value=" #{a.cars.carList}"/>

</h:selectOneMenu>

// some other form fields directly bonded to class B properties....

<

h:commandLink immediate="false"  action ="#{b.create}" styleClass="formButtonLink"

value="Create" />
</h:form>
 
The problem is the component bonded to Class A, when I try to get the the value in class B
as System.out.println(getMyCar().getId()); it always returns null. For components bonded to Class B, everything is fine. I must have done something wrong. please advice.
 
Thanks a lot!
Emily
 
On 1/17/06, Simon Kitching <[EMAIL PROTECTED]> wrote:
On Tue, 2006-01-17 at 17:07 -0500, Emily Gu wrote:
> Hi,
>
>  I have a page that have some components referencing the parent
> backing bean and some referencing the child backing bean. I need to do
> some action handling in child class. But the value of component
> referencing the parent class is null all the time. The component
> referencing the child class is fine. Do you see anything I am missing
> so that the component referencing the parent class didn't get bonded?

I think you'll need to provide some more information.

What do you mean by "parent backing bean" and "child backing bean"?

Please also include relevant parts of your JSP page and backing bean
classes.

Regards,

Simon


Reply via email to