You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "matt.payne" <ma...@gmail.com> on 2008/01/10 17:27:19 UTC

Wildcard mappings/templates need to refer to a package name

I looked through all the combinations of wild card configurations, zero
config, annotations and I can't find one that fits my work style and offers
any benefit.  I have a pattern to my development, it just doesn't fit the
current proposed solutions.  

I often have a namespace per pojo(sometimes nested).  
These include typically edit, delete, save, list operations (and sometimes
search).

I think wildcard mappings would be more powerful of a configuration
technique if they could factor in the package name.  That way, they could
take advantage of configuration inheritance.


Consider the example below.  Just by being able to refer to the ${packName}
an enourmous amount of the configuration could be sliced and diced.

<!-- template out and abstract pattern -->
<package name="Abstract-crud" extends="struts-default" namespace="/example">
	
 		<!--  edit is often used as the create/view -->
		<action name="edit" class="org.${packageName}Action">
			<result name="input" type="velocity">{actionName}.vm</result>
			<result name="success" type="velocity">{actionName}.vm</result>
			<result name="error" type="velocity">{actionName}.vm</result>
		</action>
 
		<action name="save" class="org.${packageName}Action" method="save" >
			<result name="input" type="velocity">edit.vm</result>
			<result name="success" type="chain">list</result>
			<result name="error" type="velocity">edit.vm</result>
			<result name="cancel" type="redirect">list.action</result>
		</action>

		<action name="list" class="org.${packageName}Action" method="list">
			<result name="success" type="redirectAction">list</result>
		</action>

		<action name="delete" class="org.${packageName}Action" method="delete">
			<result name="success" type="redirectAction">list</result>
		</action>

	</package>
	
        <!-- apply pattern over multple name spaces/mappings -->
	<package name="Example" extends="abstract-crud" namespace="/example"/>

	<package name="Example2" extends="abstract-crud" namespace="/example2">
		<action name="override" class="org.${packageName}Action"
method="override">
			<result name="success" type="velocity">somethingelse.vm</result>
		</action>
	</package>

	<package name="SubItem" extends="abstract-crud"
namespace="/example2/subItem">


Matthew Payne
-- 
View this message in context: http://www.nabble.com/Wildcard-mappings-templates-need-to-refer-to-a-package-name-tp14737911p14737911.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Wildcard mappings/templates need to refer to a package name

Posted by Ted Husted <hu...@apache.org>.
I think you make a good case. The best thing might be to file with
XWork, since I believe that's where the code would need to be changed.

 * http://jira.opensymphony.com/secure/Dashboard.jspa

If you had a time to review the code and suggest a patch, all the better.

HTH, Ted
<http://www.StrutsMentor.com/>

On Jan 10, 2008 11:27 AM, matt.payne <ma...@gmail.com> wrote:
>
> I looked through all the combinations of wild card configurations, zero
> config, annotations and I can't find one that fits my work style and offers
> any benefit.  I have a pattern to my development, it just doesn't fit the
> current proposed solutions.
>
> I often have a namespace per pojo(sometimes nested).
> These include typically edit, delete, save, list operations (and sometimes
> search).
>
> I think wildcard mappings would be more powerful of a configuration
> technique if they could factor in the package name.  That way, they could
> take advantage of configuration inheritance.
>
>
> Consider the example below.  Just by being able to refer to the ${packName}
> an enourmous amount of the configuration could be sliced and diced.
>
> <!-- template out and abstract pattern -->
> <package name="Abstract-crud" extends="struts-default" namespace="/example">
>
>                 <!--  edit is often used as the create/view -->
>                 <action name="edit" class="org.${packageName}Action">
>                         <result name="input" type="velocity">{actionName}.vm</result>
>                         <result name="success" type="velocity">{actionName}.vm</result>
>                         <result name="error" type="velocity">{actionName}.vm</result>
>                 </action>
>
>                 <action name="save" class="org.${packageName}Action" method="save" >
>                         <result name="input" type="velocity">edit.vm</result>
>                         <result name="success" type="chain">list</result>
>                         <result name="error" type="velocity">edit.vm</result>
>                         <result name="cancel" type="redirect">list.action</result>
>                 </action>
>
>                 <action name="list" class="org.${packageName}Action" method="list">
>                         <result name="success" type="redirectAction">list</result>
>                 </action>
>
>                 <action name="delete" class="org.${packageName}Action" method="delete">
>                         <result name="success" type="redirectAction">list</result>
>                 </action>
>
>         </package>
>
>         <!-- apply pattern over multple name spaces/mappings -->
>         <package name="Example" extends="abstract-crud" namespace="/example"/>
>
>         <package name="Example2" extends="abstract-crud" namespace="/example2">
>                 <action name="override" class="org.${packageName}Action"
> method="override">
>                         <result name="success" type="velocity">somethingelse.vm</result>
>                 </action>
>         </package>
>
>         <package name="SubItem" extends="abstract-crud"
> namespace="/example2/subItem">
>
>
> Matthew Payne
> --
> View this message in context: http://www.nabble.com/Wildcard-mappings-templates-need-to-refer-to-a-package-name-tp14737911p14737911.html
> Sent from the Struts - User mailing list archive at Nabble.com.

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