什么是异常的根本原因“org.apache.jasper.runtime.PageContextImpl.handlePageException”?

时间:2009-10-21 10:45:36

标签: java jsp exception-handling

异常日志

javax.servlet.ServletException
at  org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:536)
at org.apache.jsp.FileUploadFormatAdd_jsp._jspService(FileUploadFormatAdd_jsp.java:620)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

jsp代码的一些提取在下面给出

      </HEAD>
  <BODY leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor="#ffffff" onLoad="document.FileUploadFormatAdd.reqdFileFormatName.focus();">
 <FORM method=post name="FileUploadFormatAdd" action="FileUploadFormatAdd.jsp" onSubmit="return validate(this);" >

        

    <!-- end of standard header bar with logo -->
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
    <td width="1%" valign="top">
    <%-- Modified by Jasleen
        <!-- Left Menu Start -->
        <table border="0" width="100%" cellspacing="0" cellpadding="0">
            <tr>
                <td bgcolor="#dddddd" width="1%"><img src="images/transp.gif" height="1" width="160"></td>
            </tr>
            <tr>
                <td width="1%">
                    <!-- Start of Header Menu -->

                    <!-- End of Header Menu -->
                </td>
            </tr>
        </table>
        <!-- Left Menu End -->
        --%>
    </td>
    <td width="1%" valign="top">
        <!-- Spacer (Left Menu and Main) Start -->
        <table border="0" width="100%" cellspacing="0" cellpadding="0">
            <tr>
                <td width="1%"><img src="images/transp.gif" height="1" width="20"></td>
            </tr>
        </table>
    </td>
    <td width="99%" valign="top">
        <table border="0" cellpadding="0" cellspacing="0" width="100%">
            <tr>

                <td class="pageheader">

               </td>
                    </tr>
        </table>

        <hr color="#cccccc" size="0" noshade width="99%" align="center">

        <table border="0" width="100%" cellspacing="0" cellpadding="0">
            <td>
            FileFormatName
            <input type="text" name="reqdFileFormatName">
            </td>
        </table>


        <table border="0" width="100%" cellspacing="0" cellpadding="0">
        <tr>
        <td>Field Name</td>
        <td>Min Length</td>
        <td>Max Length</td>
        <td>Type</td>
        <td>Is Future Date Allowed</td>
        <td>Is Past Date Allowed</td>
        <td>Is Required Field</td>
        <td>Depends Upon Field Name</td>
        <td>Depends Upon Field Value(Comma Separated Values)</td>
        <td>Min Value</td>
        <td>Max Value</td>
        <td>Field Order</td>
        <td>Sql Query</td>
        </tr>

        <input type="hidden" name="noOfRows" value="<%=noOfRows%>">
        <%
        Iterator iterFieldValues=listOfFields.iterator();
        %>
        <%for (int i=0;i<noOfRows;i++){%>
        <tr>
        <%
        String fieldName=(String)iterFieldValues.next();
        %>
        <td>
        <input type="text"  name="<%="reqdFieldName"+i%>" value="<%=(fieldName!=null)?fieldName:""%>" size="20" MAXLENGTH="100">
        </td>
        <%
        String minLength=(String)iterFieldValues.next();
        %>
        <td>
        <input type="text"  name="<%="minLength"+i%>" value="<%=(minLength!=null)?minLength:""%>" size="10" MAXLENGTH="5">
        </td>
        <%
        String maxLength=(String)iterFieldValues.next();
        %>
        <td>
        <input type="text"  name="<%="maxLength"+i%>" value="<%=(maxLength!=null)?maxLength:""%>" size="10" MAXLENGTH="5"> 
        </td>
        <%
        String fieldType=(String)iterFieldValues.next();
        %>

        <td>
        <select name="<%="reqdType"+i%>" size="20" onchange='EnableFields(this.name)'> 
        <option value="">Select<option>
        <option value="CodeNo" <%=fieldType.equals("CodeNo")?"selected":"" %> >CodeNo</option>
        <option value="CodeNoSQl" <%=fieldType.equals("CodeNo")?"selected":"" %>>CodeNoSQl</option>
        <option value="Date(dd/mm/yyyy)" <%=fieldType.equals("Date(dd/mm/yyyy)")?"selected":"" %>>Date(dd/mm/yyyy)</option>
        <option value="Email" <%=fieldType.equals("Email")?"selected":"" %>>Email</option>
        <option value="Float" <%=fieldType.equals("Float")?"selected":"" %>>Float</option>
        <option value="Number" <%=fieldType.equals("Number")?"selected":"" %>>Number<option>
        <option value="Text" <%=fieldType.equals("Text")?"selected":"" %>>Text<option>
        </select>
        </td>

        <%
        String isFutureDateAllowedValue=(String)iterFieldValues.next();
        %>

        <td>
        <input type="checkBox" value="1"  name="<%="isFutureDateAllowed"+i%>" <%=isFutureDateAllowedValue.equals("1")?"checked":""%> disabled > 
        </td>
        <%
        String isPastDateAllowedValue=(String)iterFieldValues.next();
        %>
        <td>
        <input type="checkBox" value="1" name="<%="isPastDateAllowed"+i%>" <%=isPastDateAllowedValue.equals("1")?"checked":""%> disabled > 
        </td>
        <%
        String isReqdFieldValue=(String)iterFieldValues.next();
        %>

        <td>
        <input type="checkBox" value="1"  name="<%="isReqdField"+i%>" <%=isReqdFieldValue.equals("1")?"checked":""%>  > 
        </td>
        <%
        String dependsUponFieldName=(String)iterFieldValues.next();
        %>
        <td>
        <input type="text"  name="<%="dependsUponFieldName"+i%>" value="<%=(dependsUponFieldName!=null)?dependsUponFieldName:""%>" size="20" MAXLENGTH="100"> 
        </td>
        <%
        String dependsUponFieldValue=(String)iterFieldValues.next();
        %>
        <td>
        <input type="text"  name="<%="dependsUponFieldValue"+i%>" value="<%=(dependsUponFieldValue!=null)?dependsUponFieldValue:""%>" size="20" MAXLENGTH="500" >
        </td>
        <%
        String minValue=(String)iterFieldValues.next();
        %>
        <td>
        <input type="text"  name="<%="minValue"+i%>" value="<%=(minValue!=null)?minValue:""%>" size="10" MAXLENGTH="10">
        </td>
        <%
        String maxValue=(String)iterFieldValues.next();
        %>
        <td>
        <input type="text"  name="<%="maxValue"+i%>" value="<%=(maxValue!=null)?maxValue:""%>" size="10" MAXLENGTH="10">
        </td>
        <%
        String fieldOrder=(String)iterFieldValues.next();
        %>
        <td>
        <input type="text"  name="<%="reqdFieldOrder"+i%>" value="<%=(fieldOrder!=null)?fieldOrder:""%>" size="10" MAXLENGTH="3"> 
        </td>
        <%
        String sqlQuery=(String)iterFieldValues.next();
        %>

        <td>
        <input type="text"  name="<%="sqlQuery"+i%>" value="<%=(sqlQuery!=null)?sqlQuery:""%>" size="10" MAXLENGTH="1000" disabled> 
        </td>
        </tr>
        <%}%>

        <tr>
        </tr>
        </table>
        <input type="hidden" name="changeType" value="abc">
        <input name="addRow" type="button" value=" + "        onclick="this.form.changeType.value='addRow';document.FileUploadFormatAdd.submit()"></input>
        <input name="deleteRow" type="button" value=" - " onclick="this.form.changeType.value='deleteRow';document.FileUploadFormatAdd.submit()"></input>

1 个答案:

答案 0 :(得分:2)

“javax.servlet.ServletException”背后没有任何内容?服务器日志文件中的任何额外信息?

第一个非常可疑的一点是代码的这一部分,HTML位被删除

Iterator iterFieldValues=listOfFields.iterator();
for (int i=0;i<noOfRows;i++){
    String fieldName=(String)iterFieldValues.next();
    String minLength=(String)iterFieldValues.next();
    String maxLength=(String)iterFieldValues.next();
    String fieldType=(String)iterFieldValues.next();
    ...
}

你真的确定要这么做吗? Iterator然后用for循环遍历它?没有hasNext()测试?因为next()会在没有下一个元素时抛出NoSuchElementException。