This should really be a FAQ cause it's certainly frequently asked!
There are a number of different strategies. I wouldn't maintain it in the
session myself, since it's bad form (IMO) to maintain essentially
page-scope attributes in the session.
One way to do it is to push all of the paging and sorting parameters onto
the request URL. You can use JSTL to do this, something like:
<c:url value="/index.jsp" var="formUrl">
<c:forEach var="parameter" items="${paramValues}">
<c:if test="${fn:startsWith(parameter.key, 'd-')}">
<c:forEach var="value" items="${parameter.value}">
<c:param name="${parameter.key}" value="${value}"/>
</c:forEach>
</c:if>
</c:forEach>
</c:url>
<form action="${formUrl}">
</form>
You can then carry that info over to your details page, again formulate
the URL, and return back to your list with the parameters preserved. The
fn:startsWith tests for the standard displaytag param names. Also, you
probably really don't need the second forEach loop, since there's
generally only a single value per parameter...
Frehe, Torsten wrote:
> Hi,
>
> in our application we have an overview page which uses displaytag to
> display a table.
> On this page the user can select a row and use a details button to show
> the details of the selected row on a separate page.
> When the user returns to the overview page, the table is reset to its
> defaults, i.e. sort order is lost and the user sees the first page of the
> table.
> This is not the desired behaviour. We'd like the user to see the same data
> in the same order that we've shown her before using the details button.
>
> How can we save the sort and paging values to show the table in the same
> state as the user has last seen it?
>
> Any hints? Our strategy would be to store the parameters that displaytag
> has generated in the session and read them from the session.
>
> This would mean modifying the source code. If there is an out of the box
> solution we'd be glad to know.
>
>
> Regards Torsten
>
>
> ******************************************************************
> Bitte nutzen Sie die E-Mail-Verbindung mit uns ausschliesslich zum
> Informationsaustausch. Wir koennen auf diesem Wege keine
> rechtsgeschaeftlichen Erklaerungen (Auftraege etc.) entgegennehmen.
> Der Inhalt dieser Nachricht ist vertraulich und nur fuer den angegebenen
> Empfaenger bestimmt. Jede Form der Kenntnisnahme oder Weitergabe
> durch Dritte ist unzulaessig. Sollte diese Nachricht nicht fur Sie
> bestimmt
> sein, so bitten wir Sie, sich mit uns per E-Mail oder telefonisch in
> Verbindung zu setzen.
>
> Please use your E-mail connection with us exclusively for the exchange
> of information. We do not accept legally binding declarations (orders,
> etc.) by this means of communication. The contents of this message is
> confidential and intended only for the recipient indicated. Taking
> notice of this message or disclosure by third parties is not
> permitted. In the event that this message is not intended for you,
> please contact us via E-mail or phone.
>
> ******************************************************************
>
>
--
Rick Herrick
[EMAIL PROTECTED]
I haven't got time for inner peace.
"No reasonable definition of reality could be expected to permit
this."--Albert Einstein, Boris Podolsky and Nathan Rosen in 1935
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
displaytag-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/displaytag-user