我试图找到JSP文件中发生异常的位置。
我在控制台上有以下堆栈跟踪:
javax.servlet.jsp.JspTagException: No message found under code '' for locale 'en'.
at org.springframework.web.servlet.tags.MessageTag.doStartTagInternal(MessageTag.java:184)
at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:79)
at org.apache.jsp.jsp.SERVICE.myJspFile_jsp._jspx_meth_spring_005fmessage_005f4(myJspFile_jsp.java:1293)
at org.apache.jsp.jsp.SERVICE.myJspFile_jsp._jspx_meth_form_005flabel_005f1(myJspFile_jsp.java:1260)
at org.apache.jsp.jsp.SERVICE.myJspFile_jsp._jspService(myJspFile_jsp.java:319)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
这告诉我处理自定义标记时,异常位于已翻译的JSP文件的第319行。
我打开翻译JSP源:
}
out.write("\n");
out.write(" </td>\n");
out.write(" <td class=\"data\"> </td>\n");
out.write(" <td align=\"left\" valign=\"top\">\n");
out.write(" </td>\n");
out.write(" </tr>\n");
out.write(" <tr>\n");
out.write(" <td class=\"label\" width=\"200px;\">");
if (_jspx_meth_form_005flabel_005f1(_jspx_th_form_005fform_005f0, _jspx_page_context, _jspx_push_body_count_form_005fform_005f0))
return;
out.write("</td>\n");
out.write(" <td class=\"data\">");
if (_jspx_meth_form_005finput_005f0(_jspx_th_form_005fform_005f0, _jspx_page_context, _jspx_push_body_count_form_005fform_005f0))
return;
out.write("</td>\n");
out.write(" <td class=\"data\"> </td>\n");
out.write(" <td align=\"left\" valign=\"top\">\n");
out.write(" </td>\n");
out.write(" </tr>\n");
out.write(" <tr>\n");
out.write(" <td class=\"label\" width=\"200px;\">");
if (_jspx_meth_form_005flabel_005f2(_jspx_th_form_005fform_005f0, _jspx_page_context, _jspx_push_body_count_form_005fform_005f0))
return;
第319行是:
if (_jspx_meth_form_005flabel_005f1(_jspx_th_form_005fform_005f0, _jspx_page_context, _jspx_push_body_count_form_005fform_005f0))
如何从此行转到JSP文件中的行?
我的一个想法是以某种方式冗长地翻译JSP,以便翻译的JSP文件具有帮助调试的注释。 (不知道是否有像冗长的JSP翻译这样的东西):像:
out.write(" <td class=\"data\"> </td>\n"); //myJspFile:57
out.write(" <td align=\"left\" valign=\"top\">\n"); //myJspFile:58
out.write(" </td>\n"); //myJspFile:59
编辑(澄清): 错误的实际原因是无关紧要的,因为目标是跟踪异常的位置。