This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes JSF and the fly likes Value is session managed bean's attribute is nulled Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Value is session managed bean Watch "Value is session managed bean New topic
Author

Value is session managed bean's attribute is nulled

Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 746
This is a really weird thing happening right now. I'm using JSF with JPA. First off, I'm trying to print the values so I could see if the value I'm getting from the JSF page is correct.




Netbeans tried to put my controller in session scope which makes the attribute fixedItem of the fixedItem controller also in session scope.




Now, when I submit the form it will invoke a method called create which looks like this




As you can see, there are various print statements there for the employeeId attribute of fixedItem(the model not the controller this time). To my surprise, everything that is printed is null.


EMPLOYEE ID IN LOGXXXX: null
EMPLOYEE ID IN LOGX: null
EMPLOYEE ID IN LOGYYYY: null
EMPLOYEE ID IN LOG0: null
EMPLOYEE ID IN LOG1: null
EMPLOYEE ID IN LOG2: null
EMPLOYEE ID IN LOG3: null


The funny thing is that in JPA I am able to insert something in the database and it's the right value. I shouldn't be able to do this given that the values printed are all null. In my FixedItem.java(fixedItem model) the mapping looks like this...

@Embedded
private Employee employeeId;

Thanks!


SCJP 1.5
http://devpinoy.org/blogs/lamia/ - http://everypesocounts.com/
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Value is session managed bean's attribute is nulled