【问题标题】:Find unclosed tag in jsp在jsp中查找未关闭的标签
【发布时间】:2018-09-25 09:09:48
【问题描述】:

我正在使用 MySQL、Java、JSP。如果出现如下错误,如何在不手动查看代码的情况下找到错误?该文件是.jsp。网页错误:

com.itextpdf.tool.xml.exceptions.RuntimeWorkerException:无效 找到嵌套标记 td,预期结束标记 br

strBuffer.append("<tr><td colspan=\"2\" ><strong>BlahVariable</strong> 
</td>");
strBuffer.append("<td colspan=\"5\" >");

strBuffer.append("</td></tr><tr>");
strBuffer.append("<td colspan=\"2\" ><strong>BlahVariable</strong></td><td 
colspan=\"5\" >");
if(BlahVariable.equals("Y") ||BlahVariable!=0) 
    strBuffer.append(BlahVariablez);
else
    strBuffer.append("-");
strBuffer.append("</td></tr><tr>");
strBuffer.append("<td colspan=\"2\" ><strong>Blah blah <sup>&diams;</sup> 
</strong></td>");
strBuffer.append("<td colspan=\"5\" >"+ BlahVariable+"</td></tr><tr>");
strBuffer.append("<td colspan=\"2\" ><strong>BlahVariable</strong></td>");
strBuffer.append("<td colspan=\"5\" >");

【问题讨论】:

  • 最后一个&lt;/tr&gt; 不见了。
  • 嗯,手动查看代码是我们在这项业务中所做工作的 90%。没有办法(至少这次次)。

标签: java html jsp tags


【解决方案1】:
  • 可以为它创建一个Custom Exception of java
  • 因此很容易发现错误。
  • 为了避免此类错误也可以事先将代码写在html/jsp文件本身中然后Ctrl+C Ctrl+V。

【讨论】:

    猜你喜欢
    • 2023-04-01
    • 2019-05-06
    • 1970-01-01
    • 2019-05-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-19
    • 1970-01-01
    相关资源
    最近更新 更多