Hi all,

Just wanted to submit a tip for posterity after wrestling with an
issue for a couple hours with Displaytag and its auto sort links. I
certainly wish I could have found the post I'm about to write earlier
today, so hopefully this might prevent some gray hairs for someone
else someday.

I have a simple order search page with a single criterium: zip code.
The virgin visit to the page offers the input field and a "Search"
button. All subsequent searches will loop back to the same page with
the original form above and search results, if any, below.  The
ActionBean offers 'view' (default) and 'search' event handlers for a
view > page > search > view > page type of flow.

When I added Displaytag's auto-sort feature into the mix I started
getting this exception:

net.sourceforge.stripes.exception.StripesRuntimeException: Multiple
event parameters [search, view] are present in this request. Only one
event parameter may be specified per request. Otherwise, Stripes would
be unable to determine which event to execute.

Here's an example of the generated sort link:

http://mycomputer/MyApp/Search.action?d-5453-s=0&__fp=pfxUSCHKrlg%3D&_sourcePage=49_-ve0ysnAdduefxUSQiSKlo4jbrfhuXjLEvQ1KhFA%3D&d-5453-o=2&search=Enter&view=&zip=90210

Note how the link includes 'search=Enter&view=' near the end. I still
don't know where Displaytag is digging up the 'view=' part, but having
both search and view is the killer. In my case, I don't need or want
'view' because I need the search to execute again.

Fortunately (and here's the punchline), Displaytag offers the
'excludedParams' property and it works for me.  Code examples:

-- Before (bad) --

  <d:table htmlId="searchResults" id="it" name="${actionBean.results}"
           requestURI=""
           defaultsort="2" defaultorder="descending"
           class="tbloutline" style="width: 100%;">

         ... sortable columns in here

  </d:table>

-- After (good) --

  <d:table htmlId="searchResults" id="it" name="${actionBean.results}"
           requestURI="" excludedParams="view"
           defaultsort="2" defaultorder="descending"
           class="tbloutline" style="width: 100%;">

         ... sortable columns in here

  </d:table>


Cheers, and thanks for Stripes.

Ted S.

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to