0

When i am building the table the 10th column for first row comming next line, when i inspect that value than it is coming in another table.

        <table class="table" style="table-layout: fixed; width: 100%;">
                            <tr>
                                <%int l = 1;
                                String strRes = "";
                                String strIT = "";
                                String strPT = "";
                                String strCA = "";
                                for (int t = ms; t <= strResponseList.split("`", -1).length; t++) {
                                    strRes = strResponseList.split("`", -1)[t - 1];
                                    strIT = strItemTypes.split("`", -1)[t - 1];
                                    strPT = strPoints.split(",", -1)[t - 1];
                                    strCA = strCorrectAnswers[t - 1];
                                    if(bRBtnSelection){
                                    if(!"1".equals(objStudentResponse.getPilotItems().split(",")[t-1])) {   
                                    boolean bCheck = (!"XCR".equals(strIT)  ? (!CommonUtility.isValidValue(strRes) && !(strRes.equals(strCorrectAnswers[t - 1]))) || (!CommonUtility.isNumeric(strCorrectAnswers[t - 1]) && !(strRes.equals(strCorrectAnswers[t - 1]))) 
                                            || (CommonUtility.isNumeric(strRes) && CommonUtility.isNumeric(strCorrectAnswers[t - 1]) && (Float.parseFloat(strRes) != Float.parseFloat(strCorrectAnswers[t - 1])) || (!CommonUtility.isNumeric(strRes) && CommonUtility.isNumeric(strCorrectAnswers[t - 1]))) : true);
                                    if (!"0".equals(strPoints.split(",", -1)[t - 1]) && (bCheck)) {// No need to check IsNUmber and IsAlphaNumeric for XCR items
                                    if(bShowQuestion) {%> 
                                    <td class="text-left" style="width: 150px;">Questions Missed:</td><%bShowQuestion = false;}
                                    if(!"XCR".equals(strIT)) { 
                                    if(strIT.equals("GM") || strIT.equals("GGM")){
                                    if(!strPoints.split(",", -1)[t - 1].equals(strScoreList[t - 1])) {
                                        l++;
                                        if(bShowTimeSpent && strMethodOfDelivery.equals("O")){lstQuestionMiss.add(t);}
                                    %> <td class="<%=(l % 2 == 0 ? "alt" : "")%>" style="font-size: 20px;"> &nbsp;<%=t%> &nbsp;</td>
                                    <% if(l == 10) {ms = t + 1; if(t >= strResponseList.split("`", -1).length) end = false; break; } if(t >= strResponseList.split("`", -1).length) {ms = t + 1; end = false;} ;
                                    }}
                                    else{
                                    l++;    
                                    if(bShowTimeSpent && strMethodOfDelivery.equals("O")){lstQuestionMiss.add(t);}
                                    %> <td class="<%=(l % 2 == 0 ? "alt" : "")%>" style="font-size: 20px;"> &nbsp;<%=t%> &nbsp;</td>
                                    <% if(l == 10) {ms = t + 1; if(t >= strResponseList.split("`", -1).length) end = false; break; } if(t >= strResponseList.split("`", -1).length) {ms = t + 1; end = false;} ;
                                    }   
                                    } else {
                                        l++;
                                        String cXCR = strCorrectAnswers[t - 1].replaceAll("&amp;#8211;", "-");
                                        String rXCR = strRes.replaceAll("&amp;#8211;", "-").replaceAll(" ","");
                                        boolean bXC = false;
                                        if(cXCR.indexOf("`") > -1) {
                                            for(int i1 = 0; i1 < cXCR.split("`").length; i1++) {
                                                if(bXC) break;
                                                String cX = cXCR.split("`")[i1];
                                                if(!CommonUtility.isValidValue(cX) || !CommonUtility.isValidValue(rXCR.split("<br/>", -1)[i1])
                                                        || (cX.indexOf("|") == -1 && !(rXCR.split("<br/>", -1)[i1].equals(cX)))){
                                                    bXC = true;
                                                }
                                            }
                                        } else {
                                            if((cXCR.indexOf("|") > -1 && Arrays.asList(cXCR.split("\\|", -1)).indexOf(rXCR) == -1) || (cXCR.indexOf("|", -1) == -1 && !(rXCR.equals(cXCR))))
                                                bXC = true;
                                        }
                                        if(bXC){if(bShowTimeSpent && strMethodOfDelivery.equals("O")){lstQuestionMiss.add(t);}
                                        if(strMethodOfDelivery.equals("S") && !rXCR.equals(strPT)){
                                        %> <td class="<%=(l % 2 == 0 ? "alt" : "")%>" style="font-size: 20px;"> &nbsp;<%=t%> &nbsp;</td>
                                        <%}else if(strMethodOfDelivery.equals("O")){%> <td class="<%=(l % 2 == 0 ? "alt" : "")%>" style="font-size: 20px;"> &nbsp;<%=t%> &nbsp;</td> <%}
                                        if(l == 10) {ms = t + 1; if(t >= strResponseList.split("`", -1).length) end = false; break; } if(t >= strResponseList.split("`", -1).length) {ms = t + 1; end = false;} l++;}
                                    }
                                %>
                                <% }}}else{      // for All items radio button
                                    if(l == 1) {%> <td class="text-left" style="width: 250px;">Questions:</td><%}l++;
                                    if(!"XCR".equals(strIT)) { 
                                    if(strIT.equals("GM") || strIT.equals("GGM")){
                                    if(!strPoints.split(",", -1)[t - 1].equals(strScoreList[t - 1])) {
                                        if(bShowTimeSpent && strMethodOfDelivery.equals("O")){lstQuestionMiss.add(t);}
                                    %> <td class="<%=(l % 2 == 0 ? "alt" : "")%>" style="font-size: 20px;"> &nbsp;<%=t%> &nbsp;</td>
                                    <% if(l == 10) { ms = t + 1; if(t >= strResponseList.split("`", -1).length){end = false;} break; } l++; if(t >= strResponseList.split("`", -1).length) {ms = t + 1; end = false;} ;
                                    }}
                                    else{
                                    if(bShowTimeSpent && strMethodOfDelivery.equals("O")){lstQuestionMiss.add(t);}
                                    %> <td class="<%=(l % 2 == 0 ? "alt" : "")%>" style="font-size: 20px;"> &nbsp;<%=t%> &nbsp;</td>
                                    <% if(l == 10) {ms = t + 1; if(t >= strResponseList.split("`", -1).length){end = false;} break;} if(t >= strResponseList.split("`", -1).length) {ms = t + 1; end = false;} ;
                                    }   
                                    } else {
                                        String cXCR = strCorrectAnswers[t - 1].replaceAll("&amp;#8211;", "-");
                                        String rXCR = strRes.replaceAll("&amp;#8211;", "-").replaceAll(" ","");
                                        boolean bXC = false;
                                        if(cXCR.indexOf("`") > -1) {
                                            for(int i1 = 0; i1 < cXCR.split("`").length; i1++) {
                                                if(bXC) break;
                                                String cX = cXCR.split("`")[i1];
                                                if(!CommonUtility.isValidValue(cX) || !CommonUtility.isValidValue(rXCR.split("<br/>", -1)[i1])
                                                        || (cX.indexOf("|") == -1)){
                                                    bXC = true;
                                                }
                                            }
                                        } else {
                                            if((cXCR.indexOf("|") > -1 && Arrays.asList(cXCR.split("\\|", -1)).indexOf(rXCR) == -1) || (cXCR.indexOf("|", -1) == -1))
                                                bXC = true;
                                        }
                                        if(bXC){if(bShowTimeSpent && strMethodOfDelivery.equals("O")){lstQuestionMiss.add(t);}
                                        if(strMethodOfDelivery.equals("S")){
                                        %> <td class="<%=(l % 2 == 0 ? "alt" : "")%>" style="font-size: 20px;"> &nbsp;<%=t%> &nbsp;</td>
                                        <%}else if(strMethodOfDelivery.equals("O")){%> <td class="<%=(l % 2 != 0 ? "alt" : "")%>" style="font-size: 20px;"> &nbsp;<%=t%> &nbsp;</td> <%}
                                        if(l == 10) {ms = t + 1; if(t >= strResponseList.split("`", -1).length) end = false; break; } if(t >= strResponseList.split("`", -1).length) {ms = t + 1; end = false;} l++;}
                                    }
                                %> <% } if(t >= strResponseList.split("`", -1).length) end = false; }%>
                            </tr>
                        </table>

This is my table code which i used to build table, and the output is coming as:
Questions Missed:    1       2       3       4       5       6       7       9  
Your Response:   B       B           -       B       -       FT      B       B  
Correct Response:    A       AB      1       Y       A       1       TF      A       A  

Questions Missed:    10  

The Questions Missed: 10 is coming in new table, when i inspect the code it showing separate tbody for this only one value of 10.

MJR
  • 31
  • 1
  • 9
  • Can you create [fiddle](https://jsfiddle.net/) for better understanding. – Jagdish Parmar Dec 08 '15 at 12:55
  • I thing your Html brakes. Please make console your Html and perform check as it is braked or not. – Parth Trivedi Dec 08 '15 at 12:59
  • this code is done by other, im not getting where the column has breaked, when i inspect im getting value as: – MJR Dec 08 '15 at 13:15
  • < td class="text-left" style="width: 150px;">Questions Missed:  1   ....  9   10 coming in another table like:
    Questions Missed:  10  
    – MJR Dec 08 '15 at 13:17
  • No one (apart from a large number of posters on here it would seem) has written JSPs like this since about 2002. See http://stackoverflow.com/questions/3177733/how-to-avoid-java-code-in-jsp-files – Alan Hay Dec 08 '15 at 13:54
  • Can you tell me how to stop cell breaking in row of table – MJR Dec 09 '15 at 10:33
  • ok than can i delete this question – MJR Dec 10 '15 at 05:14

0 Answers0