You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Michael McGrady <mi...@michaelmcgrady.com> on 2004/07/08 23:44:59 UTC

Simplifying struts-config.xml

Is there a way to do the following using less real-estate in 
struts-config.xml?  If not, there should be:



     <action
       path='/admin_help'
       type='com.crackwillow.struts.action.ForwardAction'
       parameter='admin_help'/>

     <action
       path='/language_help'
       type='com.crackwillow.struts.action.ForwardAction'
       parameter='language_help'/>

     <action
       path='/main_help'
       type='com.crackwillow.struts.action.ForwardAction'
       parameter='main_help'/>

     <action
       path='/admin_webmaster_help'
       type='com.crackwillow.struts.action.ForwardAction'
       parameter='admin_webmaster_help'/>

     <action
       path='/admin_host_help'
       type='com.crackwillow.struts.action.ForwardAction'
       parameter='admin_host_help'/>

     <action
       path='/logon_webmaster_help'
       type='com.crackwillow.struts.action.ForwardAction'
       parameter='logon_webmaster_help'/>

     <action
       path='/logon_host_help'
       type='com.crackwillow.struts.action.ForwardAction'
       parameter='logon_host_help'/>

     <action
       path='/logon_guest_help'
       type='com.crackwillow.struts.action.ForwardAction'
       parameter='logon_guest_help'/>


     <action
       path='/register_help'
       type='com.crackwillow.struts.action.ForwardAction'
       parameter='register_help'/>

     <action
       path='/remind_me_help'
       type='com.crackwillow.struts.action.ForwardAction'
       parameter='remind_me_help'/>



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


Re: Simplifying struts-config.xml

Posted by Joe Germuska <Jo...@Germuska.com>.
At 6:16 PM -0400 7/8/04, Brian Alexander Lee wrote:
>Sounds like you should get a new xml editor if you care about file real
>estate.

I think Michael's implicit question is more about "does this really 
have to be so redundant" -- not only does it take up a lot of 
real-estate, but it's repetitive, and repetition is always something 
better handled by software than people.

As has been discussed on this thread, I think that the wildcard path 
mapping support added since Struts 1.1 should probably work for this. 
I haven't used it a lot, but this seems to be exactly the use case 
for that feature.

Joe


>BAL
>----- Original Message -----
>From: "Michael McGrady" <mi...@michaelmcgrady.com>
>To: "Struts Users Mailing List" <us...@struts.apache.org>
>Sent: Thursday, July 08, 2004 5:44 PM
>Subject: Simplifying struts-config.xml
>
>
>>  Is there a way to do the following using less real-estate in
>>  struts-config.xml?  If not, there should be:
>>
>>
>>
>>       <action
>>         path='/admin_help'
>>         type='com.crackwillow.struts.action.ForwardAction'
>>         parameter='admin_help'/>
>>
>>       <action
>>         path='/language_help'
>>         type='com.crackwillow.struts.action.ForwardAction'
>>         parameter='language_help'/>
>>
>>       <action
>>         path='/main_help'
>>         type='com.crackwillow.struts.action.ForwardAction'
>>         parameter='main_help'/>
>>
>>       <action
>>         path='/admin_webmaster_help'
>>         type='com.crackwillow.struts.action.ForwardAction'
>>         parameter='admin_webmaster_help'/>
>>
>>       <action
>>         path='/admin_host_help'
>>         type='com.crackwillow.struts.action.ForwardAction'
>>         parameter='admin_host_help'/>
>>
>>       <action
>>         path='/logon_webmaster_help'
>>         type='com.crackwillow.struts.action.ForwardAction'
>>         parameter='logon_webmaster_help'/>
>>
>>       <action
>>         path='/logon_host_help'
>>         type='com.crackwillow.struts.action.ForwardAction'
>>         parameter='logon_host_help'/>
>>
>>       <action
>>         path='/logon_guest_help'
>>         type='com.crackwillow.struts.action.ForwardAction'
>>         parameter='logon_guest_help'/>
>>
>>
>>       <action
>>         path='/register_help'
>>         type='com.crackwillow.struts.action.ForwardAction'
>>         parameter='register_help'/>
>>
>>       <action
>>         path='/remind_me_help'
>>         type='com.crackwillow.struts.action.ForwardAction'
>>         parameter='remind_me_help'/>
>>
>>
>>
>>  ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>  For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org


-- 
Joe Germuska            
Joe@Germuska.com  
http://blog.germuska.com    
"In fact, when I die, if I don't hear 'A Love Supreme,' I'll turn 
back; I'll know I'm in the wrong place."
    - Carlos Santana

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


Re: Simplifying struts-config.xml

Posted by Michael McGrady <mi...@michaelmcgrady.com>.
At 03:16 PM 7/8/2004, you wrote:
>Sounds like you should get a new xml editor if you care about file real
>estate.
>
>BAL

Hi, BAL,

Highball?

A fundamental aspect of good programming is to avoid mindless 
repetition.  That is what this post was about.  You have focused on another 
unrelated aspect.  I probably led you astray in talking about "file real 
estate".  Those lyrics really are not consistent with the tune.

I cannot get a new xml editor.  I don't use one.  I have not seemed to have 
a need for one.  What editor do you use, since we are on that topic?  I 
might as well learn something from this, eh?

Thanks for the response.

Michael



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


Re: Simplifying struts-config.xml

Posted by Brian Alexander Lee <br...@hotmail.com>.
Sounds like you should get a new xml editor if you care about file real
estate.

BAL
----- Original Message ----- 
From: "Michael McGrady" <mi...@michaelmcgrady.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Thursday, July 08, 2004 5:44 PM
Subject: Simplifying struts-config.xml


> Is there a way to do the following using less real-estate in
> struts-config.xml?  If not, there should be:
>
>
>
>      <action
>        path='/admin_help'
>        type='com.crackwillow.struts.action.ForwardAction'
>        parameter='admin_help'/>
>
>      <action
>        path='/language_help'
>        type='com.crackwillow.struts.action.ForwardAction'
>        parameter='language_help'/>
>
>      <action
>        path='/main_help'
>        type='com.crackwillow.struts.action.ForwardAction'
>        parameter='main_help'/>
>
>      <action
>        path='/admin_webmaster_help'
>        type='com.crackwillow.struts.action.ForwardAction'
>        parameter='admin_webmaster_help'/>
>
>      <action
>        path='/admin_host_help'
>        type='com.crackwillow.struts.action.ForwardAction'
>        parameter='admin_host_help'/>
>
>      <action
>        path='/logon_webmaster_help'
>        type='com.crackwillow.struts.action.ForwardAction'
>        parameter='logon_webmaster_help'/>
>
>      <action
>        path='/logon_host_help'
>        type='com.crackwillow.struts.action.ForwardAction'
>        parameter='logon_host_help'/>
>
>      <action
>        path='/logon_guest_help'
>        type='com.crackwillow.struts.action.ForwardAction'
>        parameter='logon_guest_help'/>
>
>
>      <action
>        path='/register_help'
>        type='com.crackwillow.struts.action.ForwardAction'
>        parameter='register_help'/>
>
>      <action
>        path='/remind_me_help'
>        type='com.crackwillow.struts.action.ForwardAction'
>        parameter='remind_me_help'/>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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


Re: Simplifying struts-config.xml

Posted by Nick Heudecker <ni...@systemmobile.com>.
Look into the wildcard plugin.

http://www.twdata.org/struts-wildcard/


Michael McGrady wrote:

> Is there a way to do the following using less real-estate in 
> struts-config.xml?  If not, there should be:
> 
> 
> 
>     <action
>       path='/admin_help'
>       type='com.crackwillow.struts.action.ForwardAction'
>       parameter='admin_help'/>
> 
>     <action
>       path='/language_help'
>       type='com.crackwillow.struts.action.ForwardAction'
>       parameter='language_help'/>
> 
>     <action
>       path='/main_help'
>       type='com.crackwillow.struts.action.ForwardAction'
>       parameter='main_help'/>
> 
>     <action
>       path='/admin_webmaster_help'
>       type='com.crackwillow.struts.action.ForwardAction'
>       parameter='admin_webmaster_help'/>
> 
>     <action
>       path='/admin_host_help'
>       type='com.crackwillow.struts.action.ForwardAction'
>       parameter='admin_host_help'/>
> 
>     <action
>       path='/logon_webmaster_help'
>       type='com.crackwillow.struts.action.ForwardAction'
>       parameter='logon_webmaster_help'/>
> 
>     <action
>       path='/logon_host_help'
>       type='com.crackwillow.struts.action.ForwardAction'
>       parameter='logon_host_help'/>
> 
>     <action
>       path='/logon_guest_help'
>       type='com.crackwillow.struts.action.ForwardAction'
>       parameter='logon_guest_help'/>
> 
> 
>     <action
>       path='/register_help'
>       type='com.crackwillow.struts.action.ForwardAction'
>       parameter='register_help'/>
> 
>     <action
>       path='/remind_me_help'
>       type='com.crackwillow.struts.action.ForwardAction'
>       parameter='remind_me_help'/>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 


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


Re: Simplifying struts-config.xml

Posted by Michael McGrady <mi...@michaelmcgrady.com>.
Thanks, Bill Siggelkow

At 10:14 AM 7/9/2004, you wrote:


>http://struts.apache.org/userGuide/building_controller.html#action_mapping_wildcards 
>



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


Re: Simplifying struts-config.xml

Posted by Bill Siggelkow <bi...@bellsouth.net>.
http://struts.apache.org/userGuide/building_controller.html#action_mapping_wildcards

Michael McGrady wrote:

> At 07:57 AM 7/9/2004, you wrote:
> 
>> > The new wildcard support would also work, but only if all the root 
>> paths worked this way.
>> >
>> > > <action
>> > > path='/*'
>> > > type='com.crackwillow.struts.action.ForwardAction'
>> > > parameter='{1}'/>
> 
> 
> 
> Does anyone have a quick reference to some documentation on this "new 
> wildcard support"?  Thanks.
> 
> Michael


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


Re: Simplifying struts-config.xml

Posted by Don Brown <do...@gmail.com>.
http://struts.apache.org/userGuide/building_controller.html 
Section 4.10

Don

On Fri, 09 Jul 2004 10:12:28 -0700, Michael McGrady
<mi...@michaelmcgrady.com> wrote:
> At 07:57 AM 7/9/2004, you wrote:
> > > The new wildcard support would also work, but only if all the root
> > paths worked this way.
> > >
> > > > <action
> > > > path='/*'
> > > > type='com.crackwillow.struts.action.ForwardAction'
> > > > parameter='{1}'/>
> 
> 
> Does anyone have a quick reference to some documentation on this "new
> wildcard support"?  Thanks.
> 
> Michael
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

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


Re: Simplifying struts-config.xml

Posted by Michael McGrady <mi...@michaelmcgrady.com>.
At 07:57 AM 7/9/2004, you wrote:
> > The new wildcard support would also work, but only if all the root 
> paths worked this way.
> >
> > > <action
> > > path='/*'
> > > type='com.crackwillow.struts.action.ForwardAction'
> > > parameter='{1}'/>


Does anyone have a quick reference to some documentation on this "new 
wildcard support"?  Thanks.

Michael




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


Re: Simplifying struts-config.xml

Posted by Don Brown <do...@gmail.com>.
Yes, this is the exact use case for the wildcard feature.  The search
order when trying to find an action mapping goes 'exact match' ->
'wildcard in order listed' -> 'unknown'.  Therefore, you could define
several generic wildcard mappings to match most requests but still be
able to write specific action mappings for special cases.

Don

On Thu, 8 Jul 2004 18:01:50 -0400, Ted Husted <hu...@apache.org> wrote:
> One thing people do is setup the unknown action
> 
> <action
>  type='com.crackwillow.struts.action.ForwardToForwardAction'
> unknown=true />
> 
> The ForwardToForwardToAction would example the request to see what path was requested and extract it for use with your ForwardAction.
> 
> The new wildcard support would also work, but only if all the root paths worked this way.
> 
> > <action
> > path='/*'
> > type='com.crackwillow.struts.action.ForwardAction'
> > parameter='{1}'/>
> 
> The patch I'd really like to see is adding support for "extends" to all the Struts elements, like we have for Tiles.
> 
> We should also support a properties file, so you could use ${properties} in the XML elements.
> 
> -Ted.
> 
> 
> 
> 
> On Thu, 08 Jul 2004 14:44:59 -0700, Michael McGrady wrote:
> > Is there a way to do the following using less real-estate in struts-
> > config.xml?  If not, there should be:
> >
> >
> > <action
> > path='/admin_help'
> > type='com.crackwillow.struts.action.ForwardAction'
> > parameter='admin_help'/>
> >
> > <action
> > path='/language_help'
> > type='com.crackwillow.struts.action.ForwardAction'
> > parameter='language_help'/>
> >
> > <action
> > path='/main_help'
> > type='com.crackwillow.struts.action.ForwardAction'
> > parameter='main_help'/>
> >
> > <action
> > path='/admin_webmaster_help'
> > type='com.crackwillow.struts.action.ForwardAction'
> > parameter='admin_webmaster_help'/>
> >
> > <action
> > path='/admin_host_help'
> > type='com.crackwillow.struts.action.ForwardAction'
> > parameter='admin_host_help'/>
> >
> > <action
> > path='/logon_webmaster_help'
> > type='com.crackwillow.struts.action.ForwardAction'
> > parameter='logon_webmaster_help'/>
> >
> > <action
> > path='/logon_host_help'
> > type='com.crackwillow.struts.action.ForwardAction'
> > parameter='logon_host_help'/>
> >
> > <action
> > path='/logon_guest_help'
> > type='com.crackwillow.struts.action.ForwardAction'
> > parameter='logon_guest_help'/>
> >
> >
> > <action
> > path='/register_help'
> > type='com.crackwillow.struts.action.ForwardAction'
> > parameter='register_help'/>
> >
> > <action
> > path='/remind_me_help'
> > type='com.crackwillow.struts.action.ForwardAction'
> > parameter='remind_me_help'/>
> >
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: user-unsubscribe@struts.apache.org For
> > additional commands, e-mail: user-help@struts.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

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


Re: Simplifying struts-config.xml

Posted by Ted Husted <hu...@apache.org>.
One thing people do is setup the unknown action 

<action
 type='com.crackwillow.struts.action.ForwardToForwardAction'
unknown=true />

The ForwardToForwardToAction would example the request to see what path was requested and extract it for use with your ForwardAction. 

The new wildcard support would also work, but only if all the root paths worked this way.

> <action
> path='/*'
> type='com.crackwillow.struts.action.ForwardAction'
> parameter='{1}'/>

The patch I'd really like to see is adding support for "extends" to all the Struts elements, like we have for Tiles.

We should also support a properties file, so you could use ${properties} in the XML elements.

-Ted.


On Thu, 08 Jul 2004 14:44:59 -0700, Michael McGrady wrote:
> Is there a way to do the following using less real-estate in struts-
> config.xml?  If not, there should be:
>
>
> <action
> path='/admin_help'
> type='com.crackwillow.struts.action.ForwardAction'
> parameter='admin_help'/>
>
> <action
> path='/language_help'
> type='com.crackwillow.struts.action.ForwardAction'
> parameter='language_help'/>
>
> <action
> path='/main_help'
> type='com.crackwillow.struts.action.ForwardAction'
> parameter='main_help'/>
>
> <action
> path='/admin_webmaster_help'
> type='com.crackwillow.struts.action.ForwardAction'
> parameter='admin_webmaster_help'/>
>
> <action
> path='/admin_host_help'
> type='com.crackwillow.struts.action.ForwardAction'
> parameter='admin_host_help'/>
>
> <action
> path='/logon_webmaster_help'
> type='com.crackwillow.struts.action.ForwardAction'
> parameter='logon_webmaster_help'/>
>
> <action
> path='/logon_host_help'
> type='com.crackwillow.struts.action.ForwardAction'
> parameter='logon_host_help'/>
>
> <action
> path='/logon_guest_help'
> type='com.crackwillow.struts.action.ForwardAction'
> parameter='logon_guest_help'/>
>
>
> <action
> path='/register_help'
> type='com.crackwillow.struts.action.ForwardAction'
> parameter='register_help'/>
>
> <action
> path='/remind_me_help'
> type='com.crackwillow.struts.action.ForwardAction'
> parameter='remind_me_help'/>
>
>
> --------------------------------------------------------------------
> - To unsubscribe, e-mail: user-unsubscribe@struts.apache.org For
> additional commands, e-mail: user-help@struts.apache.org



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