当前位置: 代码迷 >> Java Web开发 >> java.lang.NullPointerException错误
  详细解决方案

java.lang.NullPointerException错误

热度:79   发布时间:2016-04-17 14:22:48.0
java.lang.NullPointerException异常
<%@   page   language= "java "     pageEncoding= "GBK "   %>
<%@   include   file= "../../common.jsp "   %>
<LINK   href=../../css/css.css   rel=stylesheet>
<style   type= "text/css ">
<!--
.STYLE1   {font-family:   Verdana,   Arial,   Helvetica,   sans-serif}
-->
</style>
<link   href= "../css/css.css "   rel= "stylesheet "   type= "text/css ">
<body   bgcolor= "#F4F2F2 "   topmargin= "4 ">
<br/>
<%   Database   dsm=new   Database();
        ResultSet   rs=null;
        int   N_id=0;
        String   USER_name= " ";
        String   sqlStr= " ";
        String   N_sign= " ";
        String   N_addDate= " ";
        String   N_addUser= " ";
        String   N_title= " ";
        String   N_content= " ";
        String   N_sort= " ";
        String   S_id= " ";
        String   P_id= " ";
%>

<%
      N_id=3;
      System.out.println(N_id);
      USER_name=(String)session.getAttribute( "USER_name ");
      sqlStr= "select   *   from   newsshow   where   N_id=3 ";
      //System.out.println(sqlStr);
     
      try{
      dsm.setSqlStr(sqlStr);
      dsm.executeQuery();
      rs=dsm.getRs();
      while(rs.next()){
          N_title=rs.getString( "N_title ");
          N_content=rs.getString( "N_content ");
          N_addDate=(rs.getString( "N_addDate ")).substring(0,19);
          N_addUser=rs.getString( "N_addUser ");
          N_sort=rs.getString( "S_name ");
          N_sign=rs.getString( "P_name ");
%>
<form   method= "POST "   name= "myform "   action= "../../servlet/SortAdd ">
<table   width= "700 "   height= "127 "   border= "0 "   align= "center "
cellpadding= "0 "   cellspacing= "1 "   bgcolor= "#BBB3AA ">
<tr   bgcolor= "FBF5F0 ">
<td   height= "30 "   colspan= "4 "   align= "center "> <font   color= "#CC0000 "> <b> 新闻类别信息修改
   
   
   
    </b> </font> </td>
</tr>
<tr   bgcolor= "#FFFFFF ">
<td   width= "89 "   height= "25 "   align= "center ">
<font   face= "Verdana,   Arial,   Helvetica,   sans-serif ">
  相关解决方案