Mar 28, 2012, 9:32 PM
64 Posts

Re: Java bean and DateTime

  • Category: Managed Beans in NSF
  • Platform: Linux
  • Release: 8.5.3
  • Role: Developer
  • Tags:
  • Replies: 4
Hello Johnny!
I have not yet used the datetime picker but I did have issues with dates to the back-end.  This probably will not help you, as I did get the date over as a String. 
(1) From my JavaBean 

private String Date_Format = "MM/dd/yyyy";

SimpleDateFormat simpledateformat = new SimpleDateFormat(Date_Format);

Calendar calendar = Calendar.getInstance();

private String ExpireDate = simpledateformat.format(calendar.getTime());

  • add getters and setters for ExpireDate
  • then get it in the back-end as such doc.appendItemValue("expireDate", ExpireDate);

(2) call it from your Xpage as such

<xp:inputText value="#{SendBulletinBean.expireDate}" id="inputText1" style="font-size:9pt" />

(3) in the field's properties, reflect the field as String and Not date.
Again, you may need the dateTime picker, perhaps this can spring some ideas.