Hello Struts Users,

I  want  to create a DispatchAction that uses the request.PathInfo() instead of
request  parameters  to  get  the relevant method name to call I've called this
PathDispatchAction.

So with PathDispatchAction
http://myapp/act/customer/update
http://myapp/act/customer/add
http://myapp/act/customer/delete

Instead of with DispatchAction
http://myapp/customer.do?method=update
http://myapp/customer.do?method=add
http://myapp/customer.do?method=delete

In  both  cases  there  will  be  a  class (action/type) that has
methods like
    public ActionForward delete(ActionMapping ...etc...
            // work it
            String forward = ...
           return (mapping.findForward(forward));
    }

The  problem  I have is that requested paths map to action/path using a HashMap
this  is  done  in  ModuleConfigImpl.findActionConfig(String  path)  whereas  I
(thinks!)need to do a regexp against action/path.

i.e. '/customer/update' matches '/customer/*'

I'm  not  sure  if  I  should  create  my  own  RequestProcessor  to change the
implementation   of   processMapping(...)   or   ModuleConfigImpl   to   change
findActionConfig(...).

OR am I on a fools errand?.

DispatchAction  will  work  better  for  for  form handling as it can pickup the
method  name  from a request parameter. Where as I think it's more aesthetic to
have link urls uncluttered by request parameters and of course grouping methods
to their logical types.


Questions are therefore.
1. Is there a better way of doing this that already exists.
2. Where to make the changes RequestProcessor/RequestProcessor and how.

Any comments.
-- 
Best regards


# struts-config.xml
    <action
           path="/customer/*"   ## NOTICE /* ##

           # extends PathDispatchAction
           type="org.apache.struts.webapp.example.MyCustomer"

           # Prefix to method names
           parameter="do"
           scope="request"
           validate="false">
      <forward name="success" path="/shop"/>
      <forward name="custadded" path="/buyfish"/>
      <forward name="custdeleted" path="/nextsearch"/>
    </action>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to