Very good!
Is there a way to pass a Map of parameters in this way, or is it just a single one?
Tom
Ted Husted wrote:
> The parameter property is not mentioned in the Users Guide (yet), but it
> is in the JavaDocs.
>
> The parameter here was just the value "select". I call it "task" inside
> the Action, to leave the option of passing ?task=select as a query
> string. Of course, you could also call it parameter internally, and make
> the query string alternative "parameter=select", which would probably be
> a better convention:
>
> String parameter = mapping.getParameter();
> if (parameter==null) parameter =
> request.getParameter("parameter");
>
> Tom Miller wrote:
> >
> > Ted
> >
> > I'm not following entirely, or something may be missing here. Where is the
> > parameter name, in your case "task" specified? I don't see it in the action
> > specification. Also, where is this feature in the documentation?
> >
> > TIA
> > Tom Miller
> >
> > Ted Husted wrote:
> >
> > > Another approach is to pass the query string options using the
> > > "parameter" property of the action mapping, and then looking for them in
> > > your action. So, passing a parameter like "task=select" could also be
> > > represented as:
> > >
> > > <action
> > > parameter="select"
> > > path="/lot/Search"
> > > type="org.wxxi.gavel.lot.http.Access"
> > > name="lotForm"
> > > scope="request"
> > > validate="false"
> > > input="/do/lot/Done">
> > > <forward
> > > name="continue"
> > > path="/WEB-INF/pages/lot/Result.jsp"/>
> > > </action>
> > >
> > > and in the Action
> > >
> > > // -- Acquire other parameters
> > > String task = mapping.getParameter();
> > > if (task==null) task = request.getParameter("task");
> > >
> > > Of course, if you need to pass several parameters, the query string
> > > approach (using & for &) will let the servlet parse them out for
> > > you.
> > >
> > > -- Ted Husted, Husted dot Com, Fairport NY USA.
> > > -- Custom Software ~ Technical Services.
> > > -- Tel 716 737-3463.
> > > -- http://www.husted.com/about/struts/
> > >
> > > Jacob Thomas wrote:
> > > >
> > > > Hi Jon,
> > > > I was trying this out earlier using the Struts beta 1 release and
> > > > found that query strings with multiple parameters caused the XML parser to
> > > > give errors when it encountered either the '&' or '?' character.
> > > >
> > > > <forward name="command"
> > > > path="/context/page.jsp?param1=value1¶m2=value2&...."/>
> > > >
> > > > Based on your and Craig's feedback, I take it that this is now supported.
> > > > --
> > > > Thanks
> > > > Jacob
> >
> > --
> > Tom Miller
> > Miller Associates, Inc.
> > [EMAIL PROTECTED]
> > 641.469.3535 Phone
> > 413.581.6326 FAX
>
> -- Ted Husted, Husted dot Com, Fairport NY USA.
> -- Custom Software ~ Technical Services.
> -- Tel 716 737-3463.
> -- http://www.husted.com/about/struts/
--
Tom Miller
Miller Associates, Inc.
[EMAIL PROTECTED]
641.469.3535 Phone
413.581.6326 FAX