Hello Sir,

              I am working on Enterprise Java Bean Application on J2EE and on JRun4 application servers...
The application consists of several List Pages using Custom Tag....
 
And using the "ListTag" and "ListChunk" classes to retrieve the records.....and display it in the list page with Previous and Next buttons....
 
The Problem i am facing is that, when i come the one of the List Pages after making some criterias based on which the listing is done.....and i am listing 19 records at a time....and when i go forth and back using Next and Previous buttons... the parameter "startIndex" values also increments and decrements by 19.....
 
Now suppose the value of parameter "startIndex" is 38 after two Next Clicks....and due to some reason if i come to this list page again with the new list then the Listing of Customers starts from the 38th record and not from zero(0).....for the new record....
That the value of the parameter "startIndex" is not getting reset to zero......
 
The same issue works properly with J2EE server.....ever time i come to the List page the value of "startIndex" always starts with 0......
 
The Code snippet is as follows...
<Code>

public int doStartTag() throws JspTagException {

// make sure attributes are valid

if (numItems < 0)

throw new JspTagException("ListTag: invalid numItems");

if (startIndex < 1)

throw new JspTagException("ListTag: invalid startIndex");

// initialize param prefix and values from session attribute

initParamPrefix();

nextParamValue = pageContext.getRequest().getParameter(paramPrefix + NEXT_PARAM);

prevParamValue = pageContext.getRequest().getParameter(paramPrefix + PREV_PARAM);

startIndexParamValue = pageContext.getRequest().getParameter(paramPrefix + STARTINDEX_PARAM);

// change startIndex if necessary

if ((nextParamValue != null || prevParamValue != null) &&

(startIndexParamValue != null)) {

startIndex = Integer.parseInt(startIndexParamValue);

System.out.println("the startIndex in listTag :"+startIndex);

}

// minimum startindex is 1; if minimum no prev form should appear

if (startIndex <= 1) {

startIndex = 1;

hasPrevForm = false;

} else {

hasPrevForm = true;

}

// set up iterator

try {

collection = findCollection();

if (collection == null ||

((collection != null) && collection.size() == 0)) {

//return(SKIP_BODY);

hasNoRecordForm = true;

hasBlankRowForm = false;

//System.out.println("hasNoRecordForm (listTag): "+hasNoRecordForm);

} else {

hasBlankRowForm = true;

}

iterator = collection.iterator();

if (needsNextForm())

{

hasBlankRowForm = false;

}

hasNextForm = needsNextForm();

} catch(Exception e) {

collection = null;

return(SKIP_BODY);

}

colCount = colCount();

System.out.println("colCount in ListTag :"+colCount);

return(EVAL_BODY_INCLUDE);

}

</Code>
 
Please help me out with the problem.....Any suggestions or code are greatly appreciated...
Thanks a million in advance

Reply via email to