Known problem for quite some time...http://www.openlaszlo.org/jira/browse/LPP-354

Cary Clark wrote:
I have OL 4.0.12 as reported in the debugger window:
lzx> Debug.write(canvas.lpsversion)
4.0.12.0

I had an issue come up with dynamically adding UI elements via replication to a form with the same name and the values not all getting sent to the server (Java in my case). So I constructed a test case. Here's a small app that creates an LzParam instance, adds several parameters to it via the addValue() method, and submits it to my test server code.

===================================================
<?xml version="1.0" standalone="no"?>
<!DOCTYPE canvas SYSTEM "http://www.laszlosystems.com/lps/tools/lzx.dtd";>

<canvas>
   <include href="base/submit.lzx" />

   <dataset name="submitDS" src="/common/jsp/echoToStdOut.jsp"
            request="false" type="http"
            timeout="120000" />
<vbox name="content" >
       <hbox name="buttonsView" width="50" spacing="4">
           <button name="submitButton" text="Submit Test" >
               <handler name="onclick">
                   var ds = canvas.submitDS ;
                   var params = new LzParam() ;
                   params.addValue( "supervisorId", "1" ) ;
                   params.addValue( "supervisorId", "2" ) ;
                   params.addValue( "supervisorId", "3" ) ;
                   params.addValue( "supervisorId", "4" ) ;
                   ds.setQueryString( params );
Debug.write( "testSubmit.lzx::onclick: queryString:" + params.toString() ) ;
                   ds.doRequest();
               </handler>
           </button>
       </hbox>              </vbox>
  </canvas>
===================================================
The test jsp is a small hack of the "echo" JSP that someone @ Laszlo Systems did some years back. Instead of returning the values as XML, I write them to std out:
<?xml version="1.0"?>
<%@ page import="java.util.*" %>
<%@ page contentType="text/xml; charset=UTF-8" %>

<%
   System.out.println( "echoToStdOut.jsp:  Submitted Parameters" ) ;

     Enumeration params = request.getParameterNames();
        while(params.hasMoreElements()) {
        String n = (String)params.nextElement();
        String[] v = request.getParameterValues(n);
        for(int i = 0; i < v.length; i++) {
            String str = v[i];
            // parse query args (URLENCODING) to Unicode as UTF8
            byte p[] = str.getBytes("8859_1");
            String ustr = new String(p, 0, p.length, "UTF-8");

            System.out.print("name='" + n + "' <");
            System.out.print(ustr);
            System.out.println(">");
           }
       }
%>
===================================================

running the OL app with debug=true, I see this in the debug window when the button is clicked:

testSubmit.lzx::onclick: queryString:supervisorId=1&supervisorId=2&supervisorId=3&supervisorId=4

According to the OLdoc for LzParm->addValue(), this is correct - "Adds a value. Does not replace existing entries with the same name."

The output from the JSP, unfortunately, tells a different story:
echoToStdOut.jsp:  Submitted Parameters
name='supervisorId' <1>

This acted the same way under 4.0.11. Have I misinterpreted how this should work or is this a bug?

Thanks,
Cary

Reply via email to