-
1. Re: Problem using Seam currentDate
cash1981 Jul 20, 2009 11:19 AM (in response to oyesiji77)Could you explain why you want to use this component?
-
2. Re: Problem using Seam currentDate
zhangxiubo Jul 20, 2009 12:46 PM (in response to oyesiji77)It seems to be a type mismatch error.
@Name("org.jboss.seam.framework.currentDate") @Install(precedence=BUILT_IN) @Scope(ScopeType.STATELESS) @AutoCreate public class CurrentDate { @Unwrap public Date getCurrentDate() { return new java.sql.Date( System.currentTimeMillis() ); } }
It is apparent that the org.jboss.seam.framework.CurrentDate does not extend java.util.Data which is the super class of java.sql.Date. Referencing the CurrentDate only return you the a date object populated with the current date but the component itself should not be assigned with a Date object. Is your currentDate initialised with a Date object elsewhere?
-
3. Re: Problem using Seam currentDate
oyesiji77 Jul 20, 2009 3:31 PM (in response to oyesiji77)I am trying to use this component because I would like to obtain the current Date, although i can also use new Date(), I would have preferred using a Seam component
-
4. Re: Problem using Seam currentDate
cash1981 Jul 21, 2009 12:27 PM (in response to oyesiji77)
Jubril Oyesiji wrote on Jul 20, 2009 15:31:
I am trying to use this component because I would like to obtain the current Date, although i can also use new Date(), I would have preferred using a Seam componentRemember that this will take much longer time to perform instead of just new Date();
It will need to do a lookup and locate the currentDate component. Then go through all the interceptors and then perform unwrap. Really unnecessary if you just want a date object.Take a look at joda-time if you have bigger date stuff to perform.