Peter, the s:form tag accepts nested s:param tags (just like s:url or
s:link). You can generate the URL you want using those. Also note the use of
s:form's beanclass attribute instead of action, which saves you from having
to generate the URL in your ActionBean.

<s:form beanclass="${actionBean.class}">
<s:param name="challengeName" value="${actionBean.challengeName}" />
<s:param name="toolName" value="${actionBean.toolName}" />
<s:param name="questName" value="${actionBean.questName}" /> ...

-Ben

On Tue, Feb 17, 2009 at 5:36 PM, otismo <[email protected]> wrote:

>
> What's the best way to handle embedded parameters in a dynamically
> generated
> form action?
>
> I have an ActionBean with a url binding like this:
> @UrlBinding("/quest/{challengeName}/{toolName}/{questName}/{$event}")
>
> It has 3 embedded parameters and an event name.
>
> Then in my jsp I have: <s:form action="${actionBean.url}">.  I dynamically
> generate a new url in the ActionBean getUrl() method that looks like
> "/quest/challenge1/tool1/quest1".  Then a form button determines the event
> to call on the ActionBean referenced by the above url.
>
> When the jsp renders, the url is truncated to action="/quest".  How can I
> get the url to retain all the parameters?
>
> This issue is related to
>
> http://www.nabble.com/Pretty-URL-form-action%3D%22%22-and-required-parameters-issues-td12920339.html#a12923917
> .
> But after reading that thread, I still wasn't sure what the best solution
> is.  (Also that thread is from over a year ago, so I thought maybe things
> had changed.)
>
> This issue is also related to an open issue:
> http://www.stripesframework.org/jira/browse/STS-606.
>
> One solution is to do something like:
> <s:form action="${actionBean.url}">
> <s:hidden name="challengeName" />
> <s:hidden name="toolName" />
> <s:hidden name="questName" /> ...
>
> but that's cumbersome.  Is there an automatic way to accomplish this with a
> custom tag or something similar?
>
> Another solution is to use query parameters in the s:form action, like:
> /quest?challengeName=challenge1&toolName=tool1&questName=quest1
>
> but then I lose the ability to bind different ActionBeans to subpaths of
> the
> url in the future.
>
> It sounds from the discussion of issue sts606 above that there's no current
> way just to get Stripes to honor the full url set in the form's action
> attribute.  What's the best alternative?
>
> I'm new to both Stripes and jsp taglibs.  Thanks for any ideas,
> Peter
>
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to