• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Birth Date nightmare - passing variable between beans and java objects

 
Greenhorn
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 dateOfBirth.date 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

Person.java


DateOfBirth.java



addNewPerson.jsp


showList.jsp



faces-config.xml


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 cake looks terrible, but it tastes great! Now take a bite out of this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic