You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Bob Jacoby <bo...@gossamer-group.com> on 2009/05/11 16:18:01 UTC
Retrieving instance of XWorkConverter in 2.1.x
I'm trying to migrate code from webwork to 2.1.6 and am not sure about how
to get a reference to the XWorkConverter singleton. The
XWorkConverter.getInstance() method was removed in 2.1.x (existed in 2.0.x)
and the constructor is protected. The code I'm trying to migrate is:
//'from' is some random object
Map contextFrom = Ognl.createDefaultContext(from);
Ognl.setTypeConverter(contextFrom, XWorkConverter.getInstance());
Any suggestions would be appreciated. I've tried googling and looking at the
migration guides but didn't see anything that appeared relevant.
Thanks,
Bob
Re: Retrieving instance of XWorkConverter in 2.1.x
Posted by Musachy Barroso <mu...@gmail.com>.
If your action is instantiated by the default object factory, do this:
@Inject
public void setConverter(XWorkConverter converter) {.....}
if you are using a different object factory (I think injection still
happens with the Spring factory, but I am not 100% sure):
Dispatcher.getInstance().getContainer().getInstance(XWorkConverter.class)
as always, use at your own risk, internal "API" changes without notice.
musachy
On Mon, May 11, 2009 at 10:18 AM, Bob Jacoby <bo...@gossamer-group.com> wrote:
> XWorkConverter
--
"Hey you! Would you help me to carry the stone?" Pink Floyd
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org