-
1. rich:calendar question pls help, how to display current date
valatharv Nov 21, 2008 6:08 PM (in response to valatharv)Please suggest on this, is it possible using rich:calendar
I need to display current date as default value in rich:calendar when the page loads on create screen.
Please suggest how this can be achieved....
I tried adding label="#{currentDatetime}", we need to keep value="#{projectHome.instance.projectDateElement}" as it is mapped to database column.
<s:decorate id="projectDateElementDecoration" template="layout/edit.xhtml">
<ui:define name="label">Project Date</ui:define>
<rich:calendar id="projectDateElement"
value="#{projectHome.instance.projectDateElement}" datePattern="MM/dd/yyyy"/>
</s:decorate> -
2. Re: rich:calendar, how to display current date on Create scr
ilya_shaikovsky Nov 24, 2008 4:46 AM (in response to valatharv)so just map the value of the calendar to some request scoped bean property and set default value to today. And update real binding from this bean in you action
-
3. Re: rich:calendar, how to display current date on Create scr
valatharv Nov 24, 2008 1:45 PM (in response to valatharv)Hi Ilya,
Thanks for replying, please provide any sample, it will be very helpful and I will be very thankful to you...
Regards -
4. Re: rich:calendar, how to display current date on Create scr
valatharv Nov 24, 2008 2:50 PM (in response to valatharv)I tried this, I am able to get current date in text field, how to display in calendar, how to update real binding, please help ....
<rich:calendar id="quantExperimentDateElement"
value="#{quantExperimentHome.instance.quantExperimentDateElement}" datePattern="MM/dd/yyyy"/>
<h:inputText value="#{reagentUtil.calDate}"/>
ReagentUtil.java:
-------------------
public class ReagentUtil {
private Date calDate;
public Date getCalDate() {
calDate = new java.util.Date();
return calDate;
} -
5. Re: rich:calendar, how to display current date on Create scr
ilya_shaikovsky Nov 25, 2008 8:00 AM (in response to valatharv)look you should define the value for the calendar as #{someTempBean.date} then for example if you use command button or support to submit the form - defined action on this component and just move the values submitted to the real bean.
-
6. Re: rich:calendar, how to display current date on Create scr
valatharv Dec 5, 2008 3:53 PM (in response to valatharv)Hi Ilya,
a) I defined the value of rich calendar as suggested by you
<rich:calendar id="dateElement" value="#{dateUtil.calDate}" datePattern="MM/dd/yyyy"/>
b) As you mentioned to move the values to actual bean..
We are using seam, and will have an action "Save" which will call xxxxHome.persist()
Did you mean to get the reference of DateUtil in actualHome then move... OR anything else...
Please suggest...
ACTUAL HOME CLASS
-----------------
@Name("xxxxHome")
public class xxxxHome extends EntityHome {
public String persist(){
//NEED TO GET THE DATE FROM DATEUTIL HERE TO MOVE THE VALUES
return super.persist();
}
DateUtil.java
-------------
public class DateUtil {
....
public Date getCalDate() {
if (calDate == null)
calDate = new java.util.Date();
return calDate;
}
public void setCalDate(Date calDate) {
this.calDate = calDate;
} -
7. Re: rich:calendar, how to display current date on Create scr
valatharv Dec 7, 2008 7:31 PM (in response to valatharv)Hi,
To update, it is working fine now, I provided the condition at entity level.
I think rich:calendar should have the option to display current date on pop-up....
Regards