java - How to transfer data to another jsp -


i've built dynamic table has add button (that adds new row), delete button (deletes rows) , submit.

i wanna take information in table (i don't know how many rows user add) , process @ other jsp page.

this have far:

     <script type="text/javascript">                 var cb=new array();                 var fn=new array();                 var ln=new array();                 var email=new array();                 var i=1;                 function addrow(tableid){                     var table=document.getelementbyid(tableid);                      var rowcount=table.rows.length;                     var row=table.insertrow(rowcount);                      var cell= row.insertcell(0);                     var element=document.createelement("input");                     element.type="checkbox";                     element.name="cb"+i+"";                     cell.appendchild(element);                      var cell1=row.insertcell(1);                     cell1.innerhtml=rowcount;                      var cell2=row.insertcell(2);                     var element2=document.createelement("input");                     element2.type="text";                     element2.name="fn"+i+"";                     cell2.appendchild(element2);                      var cell3=row.insertcell(3);                     var element3=document.createelement("input");                     element3.type="text";                     element3.name="ln"+i+"";                     cell3.appendchild(element3);                      var cell4=row.insertcell(4);                     var element4=document.createelement("input");                     element4.type="email";                     element4.name="email"+i+"";                     cell4.appendchild(element4);                      i++;                 }                 function delrow(tableid){                     var table=document.getelementbyid(tableid);                     var rowcount=table.rows.length;                     for(i=0;i<rowcount;i++){                         var row=table.rows[i];                         var chkbox=row.cells[0].childnodes[0];                         if(chkbox!==null && chkbox.checked===true)                             {                                 table.deleterow(i);                                 rowcount--;                                 i--;                                 for(var k=1;k<rowcount;k++){                                     var row=table.rows[k];                                     var cell=row.cells[1];                                     cell.innerhtml=k;                                                            }                            }                     }                  }                 function valck(){                  }            </script>     </head>     <body>         <form name="form1" action="datashow.jsp"  method="get">             <input type='button' value="add" onclick="addrow('tabledata');">             <input type='button' value="delete" onclick="delrow('tabledata');">             <input type='submit' value="submit" onclick="valck()">         <table id="tabledata" border="3">                 <tr><td>chack</td><td>#</td><td>first name</td><td>last name</td><td>email</td></tr>                 <tr><td><input type='checkbox' name='cb0'></td><td>1</td><td><input type='text' name="fn0"><td><input type="text" name="ln0"></td><td><input type="email" name="email0"></td></tr>        </table>                </form>      </body> </html> 

as can see have array every field. think if put data in arrays , send query string fine not :/ example, query 3 line table

the jsp code is:

<%       string rows=request.getparameter("row");     int foo = integer.parseint("rows");     for(int i=0;i<=foo;i++){         user u =new user();         u.fn=request.getparameter("fn[i]");         u.ln=request.getparameter("ln0[i]");         u.email=request.getparameter("email[i]");      }       %> 

i 500 error.

http status 500 - internal server error

type exception report

messageinternal server error

descriptionthe server encountered internal error prevented fulfilling request.

exception

org.apache.jasper.jasperexception: pwc6033: error in javac compilation jsp

pwc6197: error occurred @ line: 10 in jsp file: /datashow.jsp pwc6199: generated servlet error: cannot find symbol symbol: variable fn location: class org.apache.jsp.datashow_jsp

pwc6197: error occurred @ line: 29 in jsp file: /datashow.jsp pwc6199: generated servlet error: no suitable method found print() method javax.servlet.jsp.jspwriter.print(java.lang.object) not applicable (actual , formal argument lists differ in length) method javax.servlet.jsp.jspwriter.print(java.lang.string) not applicable (actual , formal argument lists differ in length) method javax.servlet.jsp.jspwriter.print(char[]) not applicable (actual , formal argument lists differ in length) method javax.servlet.jsp.jspwriter.print(double) not applicable (actual , formal argument lists differ in length) method javax.servlet.jsp.jspwriter.print(float) not applicable (actual , formal argument lists differ in length) method javax.servlet.jsp.jspwriter.print(long) not applicable (actual , formal argument lists differ in length) method javax.servlet.jsp.jspwriter.print(int) not applicable (actual , formal argument lists differ in length) method javax.servlet.jsp.jspwriter.print(char) not applicable (actual , formal argument lists differ in length) method javax.servlet.jsp.jspwriter.print(boolean) not applicable (actual , formal argument lists differ in length)

note full stack traces of exception , root causes available in glassfish server open source edition 4.0 logs.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -