rich:calendar issue
its_me May 2, 2011 6:49 AMHello All,
I have a rich:calendar on my search screen. I use the date selected on the calendar, and populate the data from the db based upon the dates selected. The following is my code:
<rich:calendar id="custFromCal" value="#{myBean.strCustomFromDate}"
popup="#{myBean.popup}" locale="#{myBean.locale}"
datePattern="#{myBean.pattern}"
showApplyButton="true" style="width:200px" />
<a4j:commandLink onclick="$('searchForm:custFromCal').component.doExpand(event)" />
<rich:calendar id="custToCal" value="#{myBean.strCustomToDate}"
popup="#{myBean.popup}"
datePattern="#{myBean.pattern}" locale="#{myBean.locale}"
showApplyButton="true" style="width:200px"/>
<a4j:commandLink onclick="$('searchForm:custToCal').component.doExpand(event)" />
The corresponding bean code is,
private String strCustomFromDate;
private String strCustomToDate;
private static final String[] WEEK_DAY_LABELS = new String[] { "Sun *",
"Mon +", "Tue +", "Wed +", "Thu +", "Fri +", "Sat *" };
private Locale locale;
private boolean popup = true ;
private boolean readonly = true;
private boolean showInput = true;
private boolean enableManualInput = false;
private String pattern;
private Date currentDate;
private Date selectedDate;
private String jointPoint;
private String direction;
private String boundary;
public String getBoundary() {
if (null == boundary){
boundary = "inactive";
}
return boundary;
}
public void setBoundary(String boundary) {
this.boundary = boundary;
}
public Date getCurrentDate() {
return currentDate;
}
public void setCurrentDate(Date currentDate) {
this.currentDate = currentDate;
}
public String getDirection() {
if (null == direction){
direction = "bottomright";
}
return direction;
}
public void setDirection(String direction) {
this.direction = direction;
}
public boolean isEnableManualInput() {
return enableManualInput;
}
public void setEnableManualInput(boolean enableManualInput) {
this.enableManualInput = enableManualInput;
}
public String getJointPoint() {
if (null == jointPoint){
jointPoint = "bottomleft";
}
return jointPoint;
}
public void setJointPoint(String jointPoint) {
this.jointPoint = jointPoint;
}
public Locale getLocale() {
if (null == locale){
locale = Locale.US;
}
return locale;
}
public void setLocale(Locale locale) {
this.locale = locale;
}
public String getPattern() {
if (null == pattern){
pattern = "MM/dd/yyyy HH:mm";
}
return pattern;
}
public void setPattern(String pattern) {
this.pattern = pattern;
}
public boolean isPopup() {
return popup;
}
public void setPopup(boolean popup) {
this.popup = popup;
}
public boolean isReadonly() {
return readonly;
}
public void setReadonly(boolean readonly) {
this.readonly = readonly;
}
public Date getSelectedDate() {
return selectedDate;
}
public void setSelectedDate(Date selectedDate) {
this.selectedDate = selectedDate;
}
public boolean isShowInput() {
return showInput;
}
public void setShowInput(boolean showInput) {
this.showInput = showInput;
}
public String getStrCustomFromDate() {
return strCustomFromDate;
}
public void setStrCustomFromDate(String strCustomFromDate) {
this.strCustomFromDate = strCustomFromDate;
}
public String getStrCustomToDate() {
return strCustomToDate;
}
public void setStrCustomToDate(String strCustomToDate) {
this.strCustomToDate = strCustomToDate;
}
When I select the date and time on screen, the date comes in proper format eg: 04/24/2011 12:00 as in the bean. But while running it from server side, I get Sun Apr 24 12:00:00 GMT+05:30 2011 as date.
I need to remove this discrepancy. Is there any setting that I am missing?
Any help is appreciated.
Thanks and Regards,
Nid.