Menu

Problem dynamically setting maxRows in dbform

Help
2005-03-21
2013-06-03
  • Paul Donachy

    Paul Donachy - 2005-03-21

    Hi,

    im trying to allow a user to spec "n" the number of results per page from a query. In the List page I pass in the number from a query string and then try to populate the dbforms tag. all other items are work, but the maxrows does not.

    I get the first page ok with "n" results. However when I click for the next page of results I get a blank page. This is the first call to a servlet/control page.

    code as follows

        StringBuffer sbmr = new StringBuffer("");
        if (request.getParameter("strmr")!=null && !request.getParameter("strmr").equals(""))
            sbmr.append(request.getParameter("strmr"));   

    <db:dbform autoUpdate="false" followUp="/pol_list.jsp" maxRows="<%=sbmr.toString()%>" tableName="<%=sbTable.toString()%>" whereClause="<%=whereClause.toString()%>" >

    any help much appreciated.

     
    • Henner Kollmann

      Henner Kollmann - 2005-03-21

      Is sbmr filled on the second page?

      try a <p><%=sbmr.toString()%></p> on your page to see this!

      Henner

       
    • Paul Donachy

      Paul Donachy - 2005-03-21

      No/

      added <p><%=sbmr.toString()%></p> and sbmr is blank on the second page.

      However whereClause is also blank on second page but the query still executes correctly.

      Paul

       
      • Henner Kollmann

        Henner Kollmann - 2005-03-21

        That's right. whereClause - as part of the dbforms system - is only needed on first page. The information of the resultset is stored in the session context after the first page.

        Not so maxRows. This is needed each time the page is rendered.

        So put a hidden input field with name=strmr and value=sbmr.toString() on your page!

        Henner

         
    • Paul Donachy

      Paul Donachy - 2005-03-22

      thanks Henner,

      It is working as I want it now.

      Thanks very much

      Paul

       

Log in to post a comment.

MongoDB Logo MongoDB