Hi Guys,

  Thanks! I have thought about that. But then I decided to read the source
code.

  I did some study and  it seems much simpler than I thought:

    The function parseActionName in class DefaultActionMapper now is look
like:


  protected ActionMapping parseActionName(ActionMapping mapping) {
        if (mapping.getName() == null) {
            return mapping;
        }
        if (allowDynamicMethodCalls) {
            // handle "name!method" convention.
            String name = mapping.getName();
            int exclamation = name.lastIndexOf("!");
            if (exclamation != -1) {
                mapping.setName(name.substring(0, exclamation));
                mapping.setMethod(name.substring(exclamation + 1));
            }
        }

        /**************modify start ********************/
        String name = mapping.getName();
        int question = name.lastIndexOf("?");
        if(question !=-1){
            mapping.setName(name.substring(0,question));
            Map params = new HashMap();
            int equal = name.lastIndexOf("=");
            String key = name.substring(question+1, equal);
            String value = name.substring(equal+1);
            params.put(key, value);
            mapping.setParams(params);
        }
       /**************modify end********************/

        return mapping;
    }

  Then I run mvn to compile it  and now it works great!!!

  It can support <s:submit action = "actionname?param=value" />

  (Not ! and ? at the same time but It will be quite easy to do that~~)

 Cheers  and thanks all of your help!


Frank


2009/8/18 Struts Two <struts...@yahoo.ca>

> why do n't you define a form and make your <a href=.. tag submit the form,
> in this way you can submit any number of params you want something like
>
> <form id="myFormId" action="xxxx.action">
>    <input name="x1" type...  />
>    <input name="x2" type...  />
>    .....
> </form>
>
> <a href="javascript:(document.getElementById('myFormId')).submit()">...</a>
>
> in this way, each of your link acts like a submit button that posts a form
> that includes user's origional selection and any other thing that you want.
>
>
> --- On Wed, 8/19/09, jun hua <wwwwar3...@gmail.com> wrote:
>
> > From: jun hua <wwwwar3...@gmail.com>
> > Subject: Re: Why submit didn't support param
> > To: "Struts Users Mailing List" <user@struts.apache.org>
> > Received: Wednesday, August 19, 2009, 12:50 AM
> > Hi, Wielgus,
> >
> >   Thanks!
> >
> >   Man, That sounds great!
> >
> >   Actually I  hope struts2 can provide us
> > something like <s:submit
> > action="Actionname.action?param=123123" />
> > or <s:submit action="Actionname.action" ><param
> > name="name"
> > value="value"></s:submit>.
> >
> >   It's not the first time I got frustrated by such
> > kind of problem.
> >
> >  Actually I found  struts2 can support <s:submit
> > action="Actionname!methodname" />. the String  can
> > be parsed without any
> > problem in the source code ~_~
> >
> >
> >
> > Frank
> >
> >
> > 2009/8/18 Paweł Wielgus <poulw...@gmail.com>
> >
> > > Hi Frank,
> > > submit should be inside form,
> > > and inside form You can add hidden
> > > to add any information You like
> > > to differ from which line/id/identificator this submit
> > was pressed.
> > > So the simplest way to achieve it is to add form for
> > every row.
> > >
> > > Another solution is to use indexed properties with one
> > form,
> > > but that's another story.
> > >
> > > Best greetings,
> > > Paweł Wielgus.
> > >
> > >
> > > 2009/8/18 BlackKnight <wwwwar3...@gmail.com>:
> > > > Hi,
> > > >
> > > > Just currious y struts didn't support
> > <s:param> in <s:submit>
> > > >
> > > > I am having a problem:
> > > >
> > > > A list of controls are produced using iterator,
> > user can remove each of
> > > > them by clicking submit near each of them.
> > > >
> > > > If i use <s:url>, i can send the id of the
> > row via <param>, but the data
> > > > user has inputed will be lost! Also the iterator
> > will be empty!
> > > >
> > > > If I use <s:submit> I have no way to know
> > which row the control is
> > > located!
> > > >
> > > > Are trying to modify the struts2 source code! but
> > it's really really a
> > > > mess for a beginer like me!!
> > > >
> > > > Any suggestions?!
> > > >
> > > >
> > > >
> > > >
> > > > Frank
> > > >
> > > >
> > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> > > > For additional commands, e-mail: user-h...@struts.apache.org
> > > >
> > > >
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> > > For additional commands, e-mail: user-h...@struts.apache.org
> > >
> > >
> >
>
>
>       __________________________________________________________________
> Looking for the perfect gift? Give the gift of Flickr!
>
> http://www.flickr.com/gift/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

Reply via email to