I'm using display tags to display lists of data in multiple pages (jsp).
My problem is that after submitting the form, it's reloaded with page 1. But sometimes I'd like to reload another page (by exemple the current page where the submit was done).
Is there a way to specify the page to be shown when reloading the jsp?
i may help u
I'm displaying and getting data through a display tag in a jsp with code like this:
<display:table name="sessionScope.documentMiseEnPageForm.listeArticles" id="article"
class="liste" requestURI="" pagesize="30" decorator="com.it.bdc.utils.struts.BoutonsDecorateur">
<nested:root name="article"><nested:nest property="contenu">
<html:text property='<%="listeArticles["+(article_rowNum.intValue() - 1)+"].contenu.page"%>'
size="2" maxLength="2" styleClass="w2" onkeypress="pagine(event, this)"/><span style="display: none" index="<%=article_rowNum.intValue() - 1%>" />
As you can see, pagesize is set to "30", so if the number of articles is more important than 30, there will be more than one page, each page containing 30 articles.
is launched. This code ends with a submit() of the form. When the form is reloaded after the submit, page 1
is displayed. But if the user press "enter" in page 22, I'd like to reload the form in page 22 and not page one.
I hope this is more clear
form your details, what i understand , there might be a problem in displayNext() method in Action Class, hope you are using struts... . just check where you are forwarding the request after the end of displayNext() method. i think you are forwarding to again to make a search or something like that, so if you press enter on any page it is again going to 1st page. which means it is doing a new DB call.
i will suggest, you better do one call to DB, while displaying the results in display tag and displaytag will take care to keep the results in session and you can iterate through different pages.
hope , it will solve your problem
i am facing the same issue..based on the submit , a column value gets changed - which i why a new DB query is required..
Is there a way that the page no can be made to be rememberered while submitting requests?
After hitting Search button on displayed result I navigate using next/previous hyperlink of display tag table, I am able to navigate to respective pages but.. say, while I am on page number 3, I again click on Search button.. the result should is not RESETing and does not show first page of the result.
Following code I am executing in Action class before hitting DB..
HttpSession session = request.getSession();
ParamEncoder paramEncoder = new ParamEncoder(tableId);
String pageParam = paramEncoder.encodeParameterName(TableTagParameters.PARAMETER_PAGE);
String sortOrderParam = paramEncoder.encodeParameterName(TableTagParameters.PARAMETER_ORDER);
String sortColParam = paramEncoder.encodeParameterName(TableTagParameters.PARAMETER_SORT);
I take fresh results from DB only when I click on search button. for navigation I dont hit DB.. instead my Action class forwards it to same page.
Plz help me in resolving the issue..