aspose file tools*
The moose likes JSF and the fly likes Problems with rich:calendar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Problems with rich:calendar " Watch "Problems with rich:calendar " New topic
Author

Problems with rich:calendar

Adam Kronicki
Ranch Hand

Joined: Sep 01, 2009
Posts: 68
I have problems with using the calendar tag from richfaces framework. On my page I have two calendars to select date range (to and from). However they don't seem to work properly. I have the following problems:

1. When I click on the 'pop-up' icon the calender shows and when I pick the date it closes. However when I try to click on it again nothing happens. Sth Like a 'one time opener'...
2. When I select the date, the month is always 00 (in the browser) and in Java bean code it's January (01).
3. Is it possible to initialize the two calender dates to cover the range of 'last month'? Could anyone provide me with a example code snippet for that?

Here is my jsp code:



I use JSF and Tomcat 6
Rudra Narayan Garnaik
Ranch Hand

Joined: May 05, 2006
Posts: 39
Hi Adam,

Please folow the link for your problem:

Richfaces Calendar Demo

http://richfaces-showcase.appspot.com/richfaces/component-sample.jsf?demo=calendar&skin=blueSky

or

http://livedemo.exadel.com/richfaces-demo/richfaces/calendar.jsf

It will help you.

As you asked:
1- 'one time opener' : May be problem with your browser.
2- As written - I am not sure why it is happening, but try again from scratch- that will not happen.
3- Is it possible to initialize the two calender dates to cover the range of 'last month'? - Yes you can- Just in your bean you have to create a default constructure and assign the date for your to & from date field. It is very easy.


Happy coing.


Regards, Rudra Narayan
www.garnaik.com
Adam Kronicki
Ranch Hand

Joined: Sep 01, 2009
Posts: 68
Rudra Narayan Garnaik wrote:
3- Is it possible to initialize the two calender dates to cover the range of 'last month'? - Yes you can- Just in your bean you have to create a default constructure and assign the date for your to & from date field. It is very easy.

Well that part I know :> My question is: is it possible (how?) to get the current or 'today' date for the 'to' filed and then how to calc for the 'from' field.

edit: I saw that rich:calendar has Java API today() method. How can I call it inside the Bean Java class??
adil ourida
Greenhorn

Joined: Aug 18, 2011
Posts: 7
Hi,

for the problem 00 for mounth try yyyy/MM/dd instead of yyyy/mm/dd. I wish it could help you
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16065
    
  21


edit: I saw that rich:calendar has Java API today() method. How can I call it inside the Bean Java class??


Actually, I think "today()" is a JavaScript function that runs only on the client. The Java (server-side) equivalent would be:


Which, despite the name, is actually not just the date, but also the current time with millisecond precision. That why I like to name it "now".

The best way to get the date from a month earlier, however, is not to use Date, but to use the java Calendar classes - typically the GregorianCalendar, unless you're looking to date from the Hegira or some other less universal calendar. The Calendar object is also created with the current date/time, but there are functions to roll dates forward an backwards in days, months, years, and so forth.


Customer surveys are for companies who didn't pay proper attention to begin with.
Adam Kronicki
Ranch Hand

Joined: Sep 01, 2009
Posts: 68
Tim Holloway wrote:

edit: I saw that rich:calendar has Java API today() method. How can I call it inside the Bean Java class??


Actually, I think "today()" is a JavaScript function that runs only on the client. The Java (server-side) equivalent would be:


Which, despite the name, is actually not just the date, but also the current time with millisecond precision. That why I like to name it "now".

The best way to get the date from a month earlier, however, is not to use Date, but to use the java Calendar classes - typically the GregorianCalendar, unless you're looking to date from the Hegira or some other less universal calendar. The Calendar object is also created with the current date/time, but there are functions to roll dates forward an backwards in days, months, years, and so forth.


Yes I found this out :> I though it will be a JSF/RichFaces issue and it turned out to be plain Java knowledge shortage :> My code for now looks:



For 1&2 problems the change from mm to MM actually help. Weird but it works correct know...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problems with rich:calendar