Microsoft
Software
Hardware
Network
Question : resolve date EL in Seam code
Hi!
I have a factory that produces a date that is valid for a certain event:
@Factory(value="expireDate
", scope=ScopeType.EVENT)
public Date expireDate(Date _date){
Calendar c = Calendar.getInstance();
c.setTime(_date);
c.add(Calendar.DAY_OF_YEAR
, 14);
return c.getTime();
}
now, in my Home component I want to set that value on an instance at creation like:
@Override
protected Auction createInstance() {
Auction auction = super.createInstance();
Date now = new Date();
auction.setPublishdate(now
);
//
auction.setExpiredate("#{
expireDate
}"); /
/ obviously would not compile
return auction;
}
I illustrated what I would want up here in a very naive attempt, just to get it clear.
My question is, how do I do this? I know I can use System.getMili.. instead, but I want to know how I should do something like this.
Im new to Seam, so please inform me of anything out of the order in the approach I chose here ;)
Thanks,
Alex
Answer : resolve date EL in Seam code
Inject expireDate using @In into the component where you want to use it.
If you cannot do this because it is not a component, you can use:
Date date = (Date)Contexts.getEventCon
text().get
("expireDa
te");
auction.setExpireddate (date);
Random Solutions
Exchange 2010 installed but not accessible from OWA
RPC through HTTP keeps prompting for pw on Exchange 2010
If table does not exist then
Robocopy, security perms and local groups
I need to accumulate the values in query
E72 - How to make email work without activating data services?
100% CPU usage in vCenter but not in taskmanager on the Windows NT 4.0 VM that has been converted
Cisco CME - One DID to display its own number in caller ID
Cannot Replicate FREEBUSY from Exchange 2003 to Exchange 2010 - EVENT 14029, 4003,
Sending a web API command from Asterisk