I just implemented this. Not sure if it's too kludgy for you but:
1. Change the 'paging.banner.page.link'. This setting is normally found in
the displaytag.properties file. Copy-paste it (don't comment it out,
otherwise none of your pages will have paging links) it in your jsp, just
inside the table tag. It will over-ride the properties file setting for this
page:
<display:setProperty name="paging.banner.page.link">
a href=jvascipt:doSubmit("{1}") title=Go to page {0}>{0}
</display:setProperty>
NOTE: The href above is intentionally mis-spelled. Otherwise it would get
eaten up by the editor. The a href is missing the opening '<' and ... well,
you know how to spell javascript ... :)
2. In your javascript doSubmit() function, you have to do two things, submit
the form (with all of your search criteria fields already inside) and set
the 'd-xxxxxxx-p' value, which is the current page of results. Since
'xxxxxxx' is dynamic you can't simply stick it statically in your form as a
hidden field. You have to do it dynamically. I did it by passing {1} to my
doSubmit() function (as you can see above). This is the NAME of the page
parameter AND the value. The doSubmit() function gets something like
'd-xxxxxxx-p=3'. So you have to split the string up into two pieces - name
and value, and add the hidden field to your form with the proper name and
value. Something like this:
function doSubmit(params)
{
pagingParamAndValue=params.substring(1,params.indexOf('&'));
pagingParamAndValueArr = pagingParamAndValue.split('=');
htmlStr = "<input type='hidden' name='" + pagingParamAndValueArr[0] + "'
value='" +
pagingParamAndValueArr[1] + "'>";
var ps = document.getElementById('pagingSpan');
ps.innerHTML=htmlStr;
document.forms[0].submit();
}
'pagingSpan' is nothing more than en empty span that you stick the hidden
field into. Make sure it is WITHIN the form tag. Et voila. Instead of doing
a GET it will do a POST with all of your params and the all-important
d-xxxxxxx-p param as well!
Hope this helps!
Bob
Ed Webb wrote:
>
> Kimpton, C (Chris) wrote:
>> Hi,
>>
>> We have a search/results page that could have a lot of data that could
>> be entered into the search fields - via a cut and paste from Excel.
>>
>> So, we need to use a POST to get the data across.
>>
>> Is it possible to configure displaytag to use POST for its paging links?
>
> I don't think so
>>
>> To be honest, using POST does not sound the correct way to go to me,
>> but the only other option I can think of is based on using
>> javascriptand Ajax to post the query, get a unique queryId back and
>> then doing a GET on the id to really get the results - displaytag can
>> then also use this to manage the paging.
>
> The only time you are going to be POSTing something new is when the
> search criteria changes. These data aren't going to change when moving
> from page to page. Can you store the criteria in some form somewhere in
> the session and use them to generate the next page of results?
>
> Ed!
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> displaytag-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/displaytag-user
>
>
--
View this message in context:
http://www.nabble.com/Using-POST-for-paging-links-tp16025381p16092988.html
Sent from the DisplayTag - General mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
displaytag-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/displaytag-user