[prev in list] [next in list] [prev in thread] [next in thread] 

List:       struts-dev
Subject:    [PROPOSAL] Wildcard-matched actions
From:       Don Brown <mrdon () twdata ! org>
Date:       2003-06-30 22:18:44
[Download RAW message or body]

Perhaps now that 1.1 is final, this would be a good time to bring this up.
I've written a small extension to Struts that allows action mappings to
use wildcards in matching URIs.  The matched values can then be
substituted anywhere in the action mapping - similar to how Cocoon
operates (in fact the wildcard code was copied from Cocoon).  The code
only affects the processActionMapping method of the RequestProcessor.

Why you ask?

 - Much smaller config files
 - Use of wildcards encourages more consistency of naming action forms,
actions, and jsp files.
 - Allows for noun-based URLs in addition to current verb-based URLS,
particularly useful in REST-style web services
 - No performance loss: wildcard matching only occurs when a direct
mapping for the URI cannot be found

For example:

    <!-- Matches all edit forms -->
    <action    path="/edit*"
               type="org.apache.struts.webapp.example.Edit{1}Action"
          attribute="{1}Form"
              scope="request"
           validate="false">
      <forward name="failure"              path="/mainMenu.jsp"/>
      <forward name="success"              path="/{1}.jsp"/>
    </action>

By including this feature directly in Struts, wildcards would be available
to all Struts applications as opposed to now where wildcard support
requires a RequestProcessor extension.

For more information:

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

Don


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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic