struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Musachy Barroso <musa...@gmail.com>
Subject Re: Xwork Question - how to Inject another instance than default
Date Thu, 05 Feb 2009 20:25:30 GMT
You first define a bean with a different name, and then find a setting
that is the implementation "switch" and set it your bean name, like:

<bean type="org.apache.struts2.components.UrlRenderer"
name="myurlrenderer" class="MyPortletUrlRenderer"/>

<!-- this is the "switch" -->
<constant name="struts.urlRenderer" value="myurlrenderer" />

note that on the bean the "type" is the Struts interface and the
"class" is the actual implementation.

musachy

On Thu, Feb 5, 2009 at 3:12 PM, Torsten Krah
<tkrah@fachschaft.imn.htwk-leipzig.de> wrote:
> Hi.
> I did some rework to the struts2-portlet2-plugin to make it possible to hook
> in a custom URLBuilder.
>
> I declared a default one like this:
>
> <bean type="org.apache.struts2.portlet.util.PortletURLBuilder" name="default"
> class="Default" />
>
> My application e.g. wants to support liferay using a custom url builder.
>
> Using
>
> <bean type="org.apache.struts2.portlet.util.PortletURLBuilder" name="default"
> class=Custom />
>
> does not work because "default" is already loaded.
> How can i tell xwork, to inject my custom instance instead the default one?
> What the common way to do this?
>
> thx for help.
>
> Torsten
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Mime
View raw message