首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

JSP的有关问题呀 帮忙呀

2013-09-11 
JSP的问题呀 帮忙呀在TOMCAT测试中遇到的HTTPStatus500-typeExceptionreportmessagedescriptionTheservere

JSP的问题呀 帮忙呀
在TOMCAT测试中遇到的
HTTP   Status   500   -

type   Exception   report

message

description   The   server   encountered   an   internal   error   ()   that   prevented   it   from   fulfilling   this   request.

exception

org.apache.jasper.JasperException
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root   cause

java.lang.NullPointerException
org.apache.jsp.index_jsp._jspService(index_jsp.java:86)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

note   The   full   stack   trace   of   the   root   cause   is   available   in   the   Apache   Tomcat/5.0.28   logs.

JSP界面代码是
<%@   page   contentType= "text/html;   charset=gb2312 "   %>
<%@   page   import= "java.sql.* "%>
<jsp:useBean   id= "con "   class= "com.bwm.db.Conn "   scope= "page "/>
<html>
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 ">
<link   href= "css/default.css "   rel= "stylesheet "   type= "text/css ">
</head>
<body   background= "images/bg.jpg ">
<table   width= "100% "     border= "0 "   cellspacing= "0 "   cellpadding= "0 ">
    <tr>
        <td   height= "27 "   colspan= "3 "   align= "right "> <div   id= "link "> </div> </td>
    </tr>
    <tr>
        <td   width= "1 "   height= "36 "   background= "images/gbnavl.gif "> </td>
        <td   width= "99% "   background= "images/gbnavm.gif "> <div   id= "link1 "> <a   href= "student/ "> 学生注册 </a>   <a   href= "company/ "> 企业注册 </a> </div> </td>
        <td   width= "1 "   background= "images/gbnavr.gif "> </td>
    </tr>
</table>
<table   width= "100% "     border= "0 "   cellspacing= "0 "   cellpadding= "0 ">
    <tr>
        <td   height= "50 "     bgcolor= "#FFFFFF "> <div   id= "top "> <img   src= "images/top.gif "   width= "340 "   height= "38 "> </div> </td>
    </tr>
</table>
<table   width= "100% "   height= "400 "     border= "0 "   cellpadding= "0 "   cellspacing= "0 ">


    <tr>
        <td   valign= "top "   bgcolor= "#FFFFFF "> <table   width= "100% "     border= "0 "   cellspacing= "0 "   cellpadding= "0 ">
            <tr   align= "center "   >
                <td   width= "50% "   height= "22 "> <div   id= "font1 "> 学生求职 </div> </td>
                <td   width= "50% "   height= "22 "> <div   id= "font1 "> 企业招聘 </div> </td>
            </tr>
            <tr>
                <td   valign= "top "> <table   width= "100% "     border= "0 "   cellspacing= "0 "   cellpadding= "0 ">
<%
ResultSet   rs=con.getRs( "SELECT   a.jobid,b.name,b.school,b.specialty,b.knowledge,a.job,a.emolument   FROM   tb_sjob   AS   a,tb_student   AS   b   WHERE   a.sname=b.sname   and   getdate() <=atime   ORDER   BY   ptime   DESC ");
                while(rs.next()){
%>
            <tr>
                <td   valign= "top "> <font   id= "reg "> &lt;&lt; </font> <a   target= "_blank "   href= "view.jsp?sid= <%=rs.getString(1)%> "> [ <%=rs.getString(2)%> ]毕业于[ <%=rs.getString(3)%> , <%=rs.getString(4)%> , <%=rs.getString(5)%> ],欲求[ <%=rs.getString(6)%> ]职位,要求薪水[ <%=rs.getString(7)%> ]。 </a> &nbsp; </td>
            </tr>
<%
                }
                con.close();
%>
            <tr>
                <td> &nbsp; </td>
            </tr>
        </table> </td>
                <td   valign= "top "> <table   width= "100% "     border= "0 "   cellspacing= "0 "   cellpadding= "0 ">
<%
rs=con.getRs( "SELECT   a.jobid,b.name,b.manage,a.job,a.emolument   FROM     tb_cjob   AS   a,tb_company   AS   b   WHERE   a.cname=b.cname   and   getdate() <=atime   ORDER   BY   ptime   DESC ");
                while(rs.next()){
%>
            <tr>
                <td   valign= "top "> <font   id= "reg "> &gt;&gt; </font> <a     target= "_blank "   href= "view.jsp?cid= <%=rs.getString(1)%> "> [ <%=rs.getString(2)%> ]主要经营[ <%=rs.getString(3)%> ],招聘[ <%=rs.getString(4)%> ]职位,承诺薪水[ <%=rs.getString(5)%> ]。 </a> </td>


            </tr>
<%
                }
                con.close();
%>
            <tr>
                <td> &nbsp; </td>
            </tr>
        </table> </td>
            </tr>
        </table> </td>
        <td   width= "180 "   rowspan= "2 "   valign= "top "   bgcolor= "#F5f7f7 "> <table   width= "100% "     border= "0 "   cellspacing= "0 "   cellpadding= "0 ">
                    <tr>
                <td> <table   width= "100% "     border= "0 "   cellspacing= "0 "   cellpadding= "0 ">
                    <tr>
                        <td   height= "22 "   colspan= "2 "   align= "center "     background= "images/tdbg.jpg "> <div   id= "font1 "> 登录入口 </div> </td>
                    </tr>
                    <form   name= "form1 "   method= "post "   action= "login.jsp "> <tr>
                        <td   width= "37% "   height= "22 "   align= "center "> 用户名: </td>
                        <td   width= "63% ">
                            <input   name= "username "   type= "text "   size= "12 ">
                        </td>
                    </tr>
                    <tr>
                        <td   height= "22 "   align= "center "> 密&nbsp;&nbsp;码: </td>
                        <td   height= "22 "> <input   name= "password "   type= "password "   size= "12 "> </td>
                    </tr>
                    <tr   align= "center ">
                        <td   height= "30 "   colspan= "2 ">
                            <input   name= "select "   type= "radio "   value= "student "   checked   >


                            学生
                            <input   type= "radio "   name= "select "   value= "company ">
                            企业 </td>
                    </tr>
                    <tr   align= "center ">
                        <td   height= "30 "   colspan= "2 ">
                            <input   type= "submit "   name= "Submit2 "   value= "进入 ">
                            &nbsp;
<input   name= "Submit "   type= "reset "   value= "重置 "> </td>
                    </tr> </form>
                </table> </td>
            </tr>
<tr>
                <td> <table   width= "100% "     border= "0 "   cellpadding= "0 "   cellspacing= "0 "   background= "images/tdbg.jpg "   >
                    <tr>
                        <td   height= "27 "> <div   id= "font1 "> 友情链接 </div> </td>
                    </tr>
<%
rs=con.getRs( "SELECT   address,name   FROM   tb_flink ");
                while(rs.next()){
%>
                    <tr>
                        <td   height= "22 "> <div   id= "link2 "> <a   href= " <%=rs.getString(1)%> "   target= "_blank "> <%=rs.getString(2)%> </a> </div> </td>
                    </tr>
<%
                }
                con.close();
%>
                </table> </td>
            </tr>
            <tr>
                <td> &nbsp; </td>
            </tr>
        </table> </td>
    </tr>
</table>
<table   width= "100% "   height= "50 "     border= "0 "   cellpadding= "0 "   cellspacing= "0 ">


    <tr>
        <td   height= "1 "bgcolor= "#FFFFFF "> <hr   size= "1 "   color= "#CC3300 "   style= "position:absolute; "> </td>
    </tr>
    <tr>
        <td   bgcolor= "#FFFFFF "> &nbsp; <a   href= "mailto:mingrisoft@163.com "> 联系本站 </a>   |  
            <a   href= "admin/ "> 管理员入口 </a>   |   &copy;2006   ZuoRan </td>
    </tr>
</table>
</body>
</html>
毕业设计呀   急

[解决办法]
org.apache.jsp.index_jsp._jspService(index_jsp.java:86)
-----------
在tomcat的工作路径下找到index_jsp的86行,调试一下
[解决办法]
通常都是执行数据库操作引起的,先确定数据库是否连接上,再确认sql语句是否正确
[解决办法]
放到myeclipse中断点调式一下
[解决办法]
那就是sql语句出了问题 让没取到结果就操作了rs对象
[解决办法]
看你的jsp中好像只用了con,rs,con肯定是实例化了,问题可能就在rs上,你去掉所有rs的操作,看看有没有问题
我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.myexception.cn/java-web/317.html

热点排行