Win a copy of OCP Oracle Certified Professional Java SE 11 Developer Practice Tests this week in the OCP forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
  • paul wheaton
  • Mark Herschberg
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
  • Jj Roberts
  • Carey Brown
  • salvin francis
  • Piet Souris

Birth Date nightmare - passing variable between beans and java objects

Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello again.

I'm writing my first JSF application.
I have a problem with passing date onto "person" bean.

i have 3 beans:
person - scope: session
personManager - scope: application - holds the list of persons
dateOfBirth - scope: session - holds 3 ints from the drop down menu like select created by <h:selectOneMenu> for day, month and year and have method which creates a Date object from those 3 ints

In faces-config.xml i've added the dependency for person so the was injected into person.dob (well actually eclipse did it for me through a wizard)

Everything would be great without the fact that person.dob is always 31.12.1899 00:00:00 and not the one i've selected in the form




So the thing is i must use <h:selectOneMenu> to select DOB. I can put there a <h:inputText> (which i did and it was working using datetime converter) but that was just for testing and now i must use 3 selects which generates an Date object for person bean whis will then be stored inside the personManager bean in a list.
The thing is as i said it before, the date is always the same. If i hardcode in DateOfBirth int year = 10; then it will stay as 10 (1910).
I also did a simple jsp page to check the variables for dateOfBirth bean

and when i refresh this page i can see the variables have changed correctly so the thing is that p.setDob(dob) in person.addPerson() gets wrong Date object which is provided by dependency injection from jsf.
So finally how can i fix my problem ?
The best answer would be instructions: change this to that in here and so on...
I'm now after 48h without sleep and i'm trying to get past this problem.
This. Exactly this. This is what my therapist has been talking about. And now with a tiny ad:
the value of filler advertising in 2021
    Bookmark Topic Watch Topic
  • New Topic