OK, understand it again... 
I tried to understand this months ago during implementation the dynamic
table stuff.

Here is a short metacode what's happening:

currentRow is defined in dbform tag and read here from the page context the
first time bevor the loop starts
currentRow is reread from the pagecontext at the end of the loop cycle for
each time the db:body is rendered.

So it's necesarry to write n + 1 to the currentRow.
   

IMHO the place of the context variable currentRow is wrong. If we define it
only for the body tag the value is readed once at the beginning and can be
used then.
I do not know if we will break backwards compatibility if we change this.


Here is a little bit pseudo code extracted from the generated java code:

<db:dbform>

  org.dbforms.taglib.DbFormTag _jspx_th_db_dbform_0 =
(org.dbforms.taglib.DbFormTag)
_jspx_tagPool_db_dbform_tableName_name_multipart_maxRows_followUp_autoUpdate
.get(org.dbforms.taglib.DbFormTag.class);
   ....
  int _jspx_eval_db_dbform_0 = _jspx_th_db_dbform_0.doStartTag();
  if (_jspx_eval_db_dbform_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
      java.util.Map currentRow_BOOK = null;
       ...      
      currentRow_BOOK = (java.util.Map)
_jspx_page_context.findAttribute("currentRow_BOOK");        // READS n - 1

                        do for each row {
                                        <db:body>
                                      int _jspx_eval_db_body_0 =
_jspx_th_db_body_0.doStartTag();
                                
                                      if (!rsv.isLast()) {
// WRITES n + 1
                                            rsv.moveNext(); // teleport us
to future...
                                
                                            // This must be done because
currentRow_xxx is reread from 
                                            // the pagecontext after(!) the
body of the tag. This means 
                                            // that the current body
contains the currentRow of rsv(i - 1)
                                            // # jp 27-06-2001: replacing
"." by "_", so that SCHEMATA can be used
        
pageContext.setAttribute("currentRow_"
                                                                     +
myParent.getTableName().replace('.', '_'),
        
rsv.getCurrentRowAsMap());
                                
                                            try {
        
pageContext.setAttribute("position_"
                                                                        +
myParent.getTableName().replace('.',
        
'_'),
        
Util.encode(myParent.getTable().getPositionString(rsv),
        
pageContext.getRequest().getCharacterEncoding()));
                                            } catch (Exception e) {
                                               throw new
JspException(e.getMessage());
                                            }
                                
                                            rsv.movePrevious(); // ...and
back to present ;=)
                                         }
                                
                                </db:body>
        currentRow_BOOK = (java.util.Map)
_jspx_page_context.findAttribute("currentRow_BOOK");
        position_BOOK = (java.lang.String)
_jspx_page_context.findAttribute("position_BOOK");
                 }
</db:dbform>

Hope that helps. Lets discuss about the change.

Cheers,
Henner



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
DbForms Mailing List

http://www.wap-force.net/dbforms

Reply via email to