日期:2014-05-20  浏览次数:20795 次

不知道怎么调试




Java code
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<jsp:useBean id="sqlbean" scope="page" class="com.chrkey.bean.SqlConn" />

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <title>My JSP 'modifyto.jsp' starting page</title>

        <meta http-equiv="pragma" content="no-cache">
        <meta http-equiv="cache-control" content="no-cache">
        <meta http-equiv="expires" content="0">
        <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
        <meta http-equiv="description" content="This is my page">
        <!-- <link rel="stylesheet" type="text/css" href="styles.css">    -->

    </head>

    <body>
        <%
            String admin_id =((String)session.getAttribute("admin_id")).trim();
            String passwd_old = new String(request.getParameter("passwd_old").trim().getBytes(), "UTF-8");
            String passwd_new = new String(request.getParameter("passwd_new").trim().getBytes(), "UTF-8");
            String passwd_confirm = new String(request.getParameter("passwd_confirm").trim().getBytes(), "UTF-8");

            if (!passwd_confirm.equals(passwd_new))
                out.println("确认新密码错误");
                
            else{
              String sql="update admin set passwd='"+passwd_new+"' where id='"+admin_id+"' and passwd='"+passwd_old+"' ";
              sqlbean.executeUpdate(sql);
              response.sendRedirect("adms.jsp");
            }

        %>

    </body>
</html>



------解决方案--------------------
Java code

 String admin_id =((String)session.getAttribute("admin_id")).trim();
            String passwd_old = new String(request.getParameter("passwd_old").trim().getBytes(), "UTF-8");
            String passwd_new = new String(request.getParameter("passwd_new").trim().getBytes(), "UTF-8");
            String passwd_confirm = new String(request.getParameter("passwd_confirm").trim().getBytes(), "UTF-8");
其中一行空指针了。。。

如何debug?
首先debug方式启动,然后只要在java代码行最前面,双击设置一个断点。。。就可以调试了。。。