Hi everybody! Trouble with my set's and get's

I'm trying to save a value to a class (of the session) from a page in my application.

I use,

currentSelectedProduct.setPrice(price);

log("Just set the price in the page variable to "+price);

log("The price is set and got back and it's "+currentSelectedProduct.getPrice());

The log shows "Just set the price in the page variable to 38" then "The price is set and got back and it's null"....?!

Any suggestions?

Here are the gets and sets etc...

private Double price;

/**

* Getter for property price.

* @return Value of property price.

*/

public Double getPrice() {

log("Returning price and price is "+price);

// this returns null

return price;

}

/**

* Setter for property price.

* @param price New value of property price.

*/

public void setPrice(Double price) {

price = price;

log("Price is set to "+price);

}

Any help much appreciated,

Thanks,

Emma

[1030 byte] By [EmmaWykes] at [2007-11-26 8:54:46]
# 1
Hi!Try to update setPrice method:public void setPrice(Double price) {this.price = price;log("Price is set to "+price);}I think it can help. ;)Thanks,Roman.
Grif at 2007-7-6 22:51:17 > top of Java-index,Development Tools,Java Tools...
# 2
Hi, thanks! I tried that.I've just resorted to writing them to and getting them from the session as a workaround because I don't have time to work it out.Thanks anyway, Emma
EmmaWykes at 2007-7-6 22:51:17 > top of Java-index,Development Tools,Java Tools...