简体   繁体   中英

DisplayTag - create first page through Ajax

What I know how to do:

submit a search form through a regular request (not Ajax) , and in the new result webpage, show the first page of a table (created by DisplayTag) that can be paginated by Ajax requests (to enable Ajax with DisplayTag I use the jQuery plagin displaytag-ajax ).

What I want to do but do not know how:

I want to create the first page of the table (based on the submitted search form) by Ajax. Ie, I want to submit the search form through Ajax and create the first page of the Ajax-paginable result table in the same webpage of the search form, without loading a new webpage.

Any ideas how this can be achieved?

Use jQuery.post() to submit your form via AJAX. When the response is received, remove() the form from the DOM and add() the response.

You can use the jQuery load function to load the response from an AJAX request to a given URL into a div, and you can use the serialize function to transform the set of inputs of your search form into a query string.

The JSP page used to generate the first page of the table should just generate the table:

<%@ page ...%>
<%@ taglib ...%>
<display:table>
    ...
</display:table>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM