java - JSP - How do I print out empty when values are duplicated? -


Below I have a JSP code that prints the first picture. What I am trying to achieve in the second picture.

I have a total of 8 columns before 4 columns are printed as long as there is data from the internal inner table, in which the last 4 columns are included, where the data is different. I want to print empty data or place in columns and rows where the information from above is repeated. I can be up to 6 rows for every ID (so far left).

  & lt; Table range = "1" width = "100%" & gt; & Lt; TR & gt; & Lt; Th & gt; Student ID & lt; / Th & gt; & Lt; Th & gt; Last name & lt; / Th & gt; & Lt; Th & gt; First name & lt; / Th & gt; & Lt; Th & gt; Grade & lt; / Th & gt; & Lt; Th & gt; Events & lt; / Th & gt; & Lt; Th & gt; Interaction Level & lt; / Th & gt; & Lt; Th & gt; Ind / Team & lt; / Th & gt; & Lt; Th & gt; Event name & lt; / Th & gt; & Lt; / TR & gt; & Lt; C: forEach var = "line" item = "$ {result.rows}" & gt; & lt;% theStudentId = 123; & Gt%; & lt;% System.out.println ("at" + (new java.util.Date ()), "Student ID" + theStudentId;); & Gt%; & Lt; TR & gt; & Lt; Td> & Lt; C: out value = "$ {row.idStudents}" /> gt; & Lt; / Td> & Lt; Td> & Lt; c: out value = "$ {row.LastName}" /> gt; & Lt; / Td> & Lt; Td> & Lt; C: Out value = "$ {row.FirstName}" /> gt; & Lt; / Td> & Lt; Td> & Lt; c: out value = "$ {row.Grade}" /> & Lt; / Td> & Lt; Td> & Lt; C: out value = "$ {row.idEvents}" /> gt; & Lt; / Td> & Lt; Td> & Lt; c: out value = "$ {row.Grade}" /> & Lt; / Td> & Lt; Td> & Lt; c: Out value = "$ {row.Type}" /> gt; & Lt; / Td> & Lt; Td> & Lt; c: out value = "$ {row.Name}" /> & lt; / Td> & Lt; / TR & gt; & Lt; / C: foreach & gt;   

It is that JSP prints from now on.

present

That's what I want to get.

target

You need to keep track of the last value. Before this part:

  & lt; C: forEach var = "line" item = "$ {result.rows}" & gt;   

You should create a variable named lastStudentId (initially zero).

Inside the loop, check to see if the current student ID is equal to the final student ID (I can not tell how to do this because you did not provide type information for those areas I think they are wires). If this is the same as the previous one, then print the blank TD (e.g., one containing & amp; nbsp;). If it is not, then you normally do this.

At the bottom of the loop, assign final student ID = line.add student and you can go.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -