Well, that's a great idea, but unfortunately not available until 1.6 is 
released.  But that will definitely work at that point.  Thanks Remi.

If that trick is mentioned in the FAQ or the type converter / configuration 
doco, I would close 701 as won't fix since changing that interface breaks 
backwards compatibility.  I know I for one would not want to update all of our 
25+ type converter classes.



From: VANKEISBELCK Remi [mailto:r...@rvkb.com]
Sent: Friday, June 24, 2011 4:37 AM
To: Stripes Users List
Subject: Re: [Stripes-users] TypeConverter API - can I get the current field 
name?

Hi John,

There's a Workaround : actually you can access the action bean for a a request 
from anywhere through the ExecutionContext. See 
net.sourceforge.stripes.controller.ExecutionContext#currentContext. You can do :

ExecutionContext.currentContext().getActionBean();

Cheers

Remi
2011/6/23 Newman, John W <newma...@d3onc.com<mailto:newma...@d3onc.com>>
I did not know that.  Nearly 5 years of using stripes, you think I would know 
that by now.    errors.add(new 
LocalizableError("validation.expression.valueFailedExpression"));  is working 
fine.

But yeah, the current action bean instance would be a great addition.  
http://www.stripesframework.org/jira/browse/STS-701  looks like what I'm 
getting at.   Perhaps a simple StripesFilter.getCurrentActionBean() or 
something like that might be a possibility as opposed to changing old interface 
signatures.

Thanks Freddy

-----Original Message-----
From: Freddy Daoud [mailto:xf2...@fastmail.fm<mailto:xf2...@fastmail.fm>]
Sent: Thursday, June 23, 2011 1:27 PM
To: 
stripes-users@lists.sourceforge.net<mailto:stripes-users@lists.sourceforge.net>
Subject: Re: [Stripes-users] TypeConverter API - can I get the current field 
name?

Hi John,

The type converter doesn't need to be given the field name. The field name is 
automatically provided as the {0} parameter when constructing the error message 
from the resource bundle, and {1} the value entered by the user. Ideally you 
use a ScopedLocalizableError, so that the user of your type converter can make 
good use of the lookup strategy to organize resource bundle keys.

I agree that it would be useful for the type converter to be given more 
context. Perhaps just the ActionBean, because from there you can get the 
ActionBeanContext, then the request, response, session, ...

Cheers,
Freddy



------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe, 
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today.
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net<mailto:Stripes-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/stripes-users


------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today.
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net<mailto:Stripes-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/stripes-users

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a 
definitive record of customers, application performance, security 
threats, fraudulent activity and more. Splunk takes this data and makes 
sense of it. Business sense. IT sense. Common sense.. 
http://p.sf.net/sfu/splunk-d2d-c1
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to