Re: Display GregorianCalendar Objects
Michal, I wanted the user to input his birth-date. Displaying the current date will be of no use for it.
Re: Display GregorianCalendar Objects
In that case you must use own converter like this: public class DateTimeConverter extends StrutsTypeConverter { @Override public Object convertFromString(Map context, String[] values, Class toClass) { try { return DateUtil.getConvertedDate(values[0], DateUtil.DATE_TIME); } catch (TypeConversionException tce) { log.error(Exception while parsing date., tce); } return null; } } Method getConvertedDate() just parse inserted date as string by user. Reeshi Agrawal wrote on 28.7.2010 15:05: Michal, I wanted the user to input his birth-date. Displaying the current date will be of no use for it.
Re: Display GregorianCalendar Objects
On Tue, 2010-07-27 at 21:45 +0200, Michal Ciasnocha wrote: Why don't use Struts tag s:date for date formatting? in Action: public GregorianCalendar getMyDate() { return new GregorianCalendar(); } in jsp: s:date name=myDate format=d. M. HH:mm / Michal Hi all, i do it like that: in my POJO GregorianCalendar field, on my jsp text field + jquery calendar. If You want to create date in some kind of predefined format You can use Conventer for GregorianCalendar for your app. Ah, too easy... I had been using DateTimePicker and confused the two. Well in my efforts to output the GregorianCalendar object in OGNL I had troubles, although it is clearly not the best way (clearly to me now that is)... Perhaps someone can explain: 1) Casting in OGNL, and 2) Referencing static field definitions in OGNL... For instance in my efforts to get the date out I wrote: s:property value= '' + courseStartDate.get(1) + '-' + {courseStartDate.get(2) + 1} + '-' + courseStartDate.get(5)/ Where: courseStartDate.get(1) aught to be written courseStartDate.get(Calendar.YEAR), courseStartDate.get(2) aught to be written courseStartDate.get(MONTH) courseStartDate.get(5) aught to be written courseStartDate.get(Calendar.DATE), maybe it works it just didn't seem to for me... Then I had difficulties because of automatic type conversion... The Month is 0 based so I need to add 1 to the date, so I tried... (courseStartDate.get(2) + 1) but I think that resulted in the string 1 being appended to the end of everything... the closest I could get was {courseStartDate.get(2) + 1} and that prints the correct number but inside square brackets. So after all that Michal pointed out the obvious and I threw all this out the window and just used the date tag but I'd still like to address these issues.
Re: Display GregorianCalendar Objects
Same problem with me... I want (through Struts 2 tags), a way to display date as three adjacent (side-by-side) drop-down menus, one each for date,month and year. Normally what will happen is: the three drop-down menus will be displayed in three separate consecutive rows in the HTML table generated in Struts 2. But I want them to be present in a single row in the displayed HTML table. Do I need to do some modification in the freeMarker templates' .ftl files? Or is there another very simple thing that I am missing? I know I am asking a very simp;e thing, but its bugging me from quite some time...
Re: Display GregorianCalendar Objects
Hi all, i do it like that: in my POJO GregorianCalendar field, on my jsp text field + jquery calendar. If You want to create date in some kind of predefined format You can use Conventer for GregorianCalendar for your app. Best greetings, Paweł Wielgus. 2010/7/27 Reeshi Agrawal rushiagra...@gmail.com: Same problem with me... I want (through Struts 2 tags), a way to display date as three adjacent (side-by-side) drop-down menus, one each for date,month and year. Normally what will happen is: the three drop-down menus will be displayed in three separate consecutive rows in the HTML table generated in Struts 2. But I want them to be present in a single row in the displayed HTML table. Do I need to do some modification in the freeMarker templates' .ftl files? Or is there another very simple thing that I am missing? I know I am asking a very simp;e thing, but its bugging me from quite some time... - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Display GregorianCalendar Objects
Why don't use Struts tag s:date for date formatting? in Action: public GregorianCalendar getMyDate() { return new GregorianCalendar(); } in jsp: s:date name=myDate format=d. M. HH:mm / Michal Hi all, i do it like that: in my POJO GregorianCalendar field, on my jsp text field + jquery calendar. If You want to create date in some kind of predefined format You can use Conventer for GregorianCalendar for your app. Best greetings, Paweł Wielgus. 2010/7/27 Reeshi Agrawalrushiagra...@gmail.com: Same problem with me... I want (through Struts 2 tags), a way to display date as three adjacent (side-by-side) drop-down menus, one each for date,month and year. Normally what will happen is: the three drop-down menus will be displayed in three separate consecutive rows in the HTML table generated in Struts 2. But I want them to be present in a single row in the displayed HTML table. Do I need to do some modification in the freeMarker templates' .ftl files? Or is there another very simple thing that I am missing? I know I am asking a very simp;e thing, but its bugging me from quite some time... - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org