html - Java servlet stops printing table half way through -


i encountering confusing bug when attempting print html table servlet. last row printing 4/8 elements , stopping. there no problem first 7 rows, practically identical 8th.

here java code:

... out.println("<tr>"); j = 0; (int i=56; i<64; i++){     j++;     integer.tostring(j);     out.println("<td ");     if (seats[i].label.equals(label)){         seats[i].booked = true;         seats[i].id = id;         seats[i].phone = phone;         seats[i].address = address;         seats[i].email = email;     }     if (!seats[i].booked){         out.println("bgcolor='#7cfc00'");     }     out.println("><a");     if (!seats[i].booked){         out.println(" href='booking?label=h"+j+"'");     }     out.println(">h"+j+"</a></td>"); } out.println("</trr"); 

and here resulting html code browser:

... <tr> <td bgcolor="#7cfc00"><a  href="http://localhost:8080/assignment1/booking? label=h1">h1</a></td> <td bgcolor="#7cfc00"><a  href="http://localhost:8080/assignment1/booking? label=h2">h2</a></td> <td bgcolor="#7cfc00"><a  href="http://localhost:8080/assignment1/booking? label=h3">h3</a></td> <td bgcolor="#7cfc00"><a  href="http://localhost:8080/assignment1/booking? label=h4">h4</a></td> </tr></tbody></table> 

the array length of seats 100 there plenty of space if why elements not displaying. loop should execute 8 times , show remaining 4 required elements previous 7 loops did successfully. love i'm stumped , need first servlet assignment done before it's late.

i have commented below code(because don't have seating.ser) of main.java in local system:

//deseriailzing seating             /*try {                 fileinputstream filein = new fileinputstream("seating.ser");                 objectinputstream in = new objectinputstream(filein);                 seats = (seat[]) in.readobject();                 in.close();                 filein.close();             } catch (ioexception i) {                 i.printstacktrace();                 out.println("ioexception i");                 //return;             } catch (classnotfoundexception c) {                 out.println("employee class not found");                 c.printstacktrace();                 //return;             }*/ 

and

//  objectoutputstream oos = null;             //          fileoutputstream fout = null;              /*try {               fileoutputstream fileout = new fileoutputstream("seating.ser");               objectoutputstream out2 = new objectoutputstream(fileout);               out2.writeobject(seats);               out2.close();               fileout.close();               system.out.printf("serialized data saved in seating.ser");               }catch(ioexception i) {               i.printstacktrace();               }*/ 

then executed. it's working fine.so issue in seating.ser file or above commented code.

here seat class(this used in main.java) code:

public class seat {     string label,phone,address,email,bookingtime;     string id="";     boolean booked; } 

i'm attaching here output screen-shot.please see. enter image description here


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -