cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Java named constants in method calls
Date Fri, 04 Jan 2002 12:30:19 GMT

I am very new to XSL and Cocoon but I don't think that this is too stupid   
a question so here is the problem...

I have instantiated a new java GregorianCalendar object

<xsl:variable name="cal" select=""   

which works fine. I can also get the date from this using the getTime()   

... select="java:getTime($cal)" />

what I can't work out is how to use other methods of the   
GregorianCalendar class where named constants are used. For example I   
want to get the last day of the current month using the getMaximum method   
which in java would be
cal.getMaximum(DAY_OF_MONTH), however, I passing the args of DAY_OF_MONTH   
using the java extended syntax doesn't work. I can get the method to   
return something when I use an integer value for the args, but not the   
named constant.

... select="java.getMaximum($cal, DAY_OF_MONTH)" />   doesn't work (ie.   
returns 0)
... select="java.getMaximum($cal, 6)" /> ----- returns 366 so presumably   
6 is the integer for YEAR

I imagine I could get hold of the source code for GregorianCalendar and   
establish what the integer values are from there but surely there must be   
a way of using the named constant?

Any help would be very much appreciated.

Please check that your question has not already been answered in the
FAQ before posting. <>

To unsubscribe, e-mail: <>
For additional commands, e-mail: <>

View raw message