You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by phpsurf <ph...@ifrance.com> on 2003/04/09 11:46:48 UTC
Best Practices to Customize Struts-Config and its DTD
Hi
I need to add some complex XML elements in the struts-config.xml
and I'm looking for the best way to do it.
My needs are :
1- add custom xml elements inside <action> elements.
2- be able to validate the struts-config.xml document. (I'd prefer not to disable the 'validating' param in web.xml)
3- as I will need to customize the DTD, how can I remain compliant with future releases of the Struts' DTD ? Is it possible to play with namespaces to achieve a good separation between my tags and Struts' tags ? would it be better to use XSD than DTD ?
thanks for advices and ideas :)
ps: sample xml code:
<action-mappings type="sample.MyActionMapping">
<action>
<myTag val1="xxx" val2="xxx"/>
<forward name="xxx" path="xxx"/>
</action>
</action-mappings>
ps: I've already tested the digester side (adding a param 'rulesets' in web.xml)
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Best Practices to Customize Struts-Config and its DTD
Posted by Gareth Andrew <ga...@ntlworld.com>.
Why not
<action className="MyExtendedMapping" path="...">
<set-property property="config" value="some_config_file.xml"/>
<forward name="xxx" path="xxx"/>
</action>
That way you can write your own dtd and stay struts-compliant.
Just my 2pence,
Gareth
phpsurf wrote:
> Yes, I used that for another feature in my application.
> But, here, the element to setup is more complex than a single value (as it has to be with set-property)
> I also tried to use a set of set-property elements, but it becomes a real mess, and it's getting difficult to identify a bug, as there's no way to validate the config.
>
>
>>-----Original Message-----
>>From: Nicolas De Loof [mailto:nicolas.deloof@cgey.com]
>>Sent: mercredi 9 avril 2003 11:59
>>To: Struts Users Mailing List
>>Subject: Re: Best Practices to Customize Struts-Config and its DTD
>>
>>
>>Did you try extending ActionMapping and using <set-property>
>>inside <action> ?
>>
>><action className="MyExtendedMapping"
>> path="...">
>> <set-property property="val1" value="foo.bar.anything_you_need" />
>> <set-property property="val2" value="foo.bar.anything_you_need" />
>> <forward name="xxx" path="xxx"/>
>></action>
>>
>>This is the only way to be Struts-compliant.
>>
>>Nico.
>>
>>
>>
>>Hi
>>
>>I need to add some complex XML elements in the struts-config.xml
>>and I'm looking for the best way to do it.
>>
>>My needs are :
>>
>>1- add custom xml elements inside <action> elements.
>>2- be able to validate the struts-config.xml document. (I'd
>>prefer not to disable the 'validating' param in web.xml)
>>3- as I will need to customize the DTD, how can I remain
>>compliant with future releases of the Struts' DTD ? Is it
>>possible to play with namespaces to achieve a good separation
>>between my tags and Struts' tags ? would it be better to
>>use XSD than DTD ?
>>
>>thanks for advices and ideas :)
>>
>>ps: sample xml code:
>>
>><action-mappings type="sample.MyActionMapping">
>>
>><action>
>><myTag val1="xxx" val2="xxx"/>
>><forward name="xxx" path="xxx"/>
>></action>
>>
>></action-mappings>
>>
>>ps: I've already tested the digester side (adding a param
>>'rulesets' in web.xml)
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>
>>_____________________________________________________________________
>>Envie de discuter en "live" avec vos amis ? Tl charger MSN Messenger
>>http://www.ifrance.com/_reloc/m la 1re messagerie instantan e de France
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
RE: Best Practices to Customize Struts-Config and its DTD
Posted by phpsurf <ph...@ifrance.com>.
Yes, I used that for another feature in my application.
But, here, the element to setup is more complex than a single value (as it has to be with set-property)
I also tried to use a set of set-property elements, but it becomes a real mess, and it's getting difficult to identify a bug, as there's no way to validate the config.
> -----Original Message-----
> From: Nicolas De Loof [mailto:nicolas.deloof@cgey.com]
> Sent: mercredi 9 avril 2003 11:59
> To: Struts Users Mailing List
> Subject: Re: Best Practices to Customize Struts-Config and its DTD
>
>
> Did you try extending ActionMapping and using <set-property>
> inside <action> ?
>
> <action className="MyExtendedMapping"
> path="...">
> <set-property property="val1" value="foo.bar.anything_you_need" />
> <set-property property="val2" value="foo.bar.anything_you_need" />
> <forward name="xxx" path="xxx"/>
> </action>
>
> This is the only way to be Struts-compliant.
>
> Nico.
>
>
>
> Hi
>
> I need to add some complex XML elements in the struts-config.xml
> and I'm looking for the best way to do it.
>
> My needs are :
>
> 1- add custom xml elements inside <action> elements.
> 2- be able to validate the struts-config.xml document. (I'd
> prefer not to disable the 'validating' param in web.xml)
> 3- as I will need to customize the DTD, how can I remain
> compliant with future releases of the Struts' DTD ? Is it
> possible to play with namespaces to achieve a good separation
> between my tags and Struts' tags ? would it be better to
> use XSD than DTD ?
>
> thanks for advices and ideas :)
>
> ps: sample xml code:
>
> <action-mappings type="sample.MyActionMapping">
>
> <action>
> <myTag val1="xxx" val2="xxx"/>
> <forward name="xxx" path="xxx"/>
> </action>
>
> </action-mappings>
>
> ps: I've already tested the digester side (adding a param
> 'rulesets' in web.xml)
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
> _____________________________________________________________________
> Envie de discuter en "live" avec vos amis ? Tl charger MSN Messenger
> http://www.ifrance.com/_reloc/m la 1re messagerie instantan e de France
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Best Practices to Customize Struts-Config and its DTD
Posted by Nicolas De Loof <ni...@cgey.com>.
Did you try extending ActionMapping and using <set-property> inside <action> ?
<action className="MyExtendedMapping"
path="...">
<set-property property="val1" value="foo.bar.anything_you_need" />
<set-property property="val2" value="foo.bar.anything_you_need" />
<forward name="xxx" path="xxx"/>
</action>
This is the only way to be Struts-compliant.
Nico.
Hi
I need to add some complex XML elements in the struts-config.xml
and I'm looking for the best way to do it.
My needs are :
1- add custom xml elements inside <action> elements.
2- be able to validate the struts-config.xml document. (I'd prefer not to disable the 'validating' param in web.xml)
3- as I will need to customize the DTD, how can I remain compliant with future releases of the Struts' DTD ? Is it
possible to play with namespaces to achieve a good separation between my tags and Struts' tags ? would it be better to
use XSD than DTD ?
thanks for advices and ideas :)
ps: sample xml code:
<action-mappings type="sample.MyActionMapping">
<action>
<myTag val1="xxx" val2="xxx"/>
<forward name="xxx" path="xxx"/>
</action>
</action-mappings>
ps: I've already tested the digester side (adding a param 'rulesets' in web.xml)
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org