MD5 加密问题,在java文件中调用有问题
MD5类没有问题,几经测试,可以在 test.jsp中正常使用,但是在newManage中调用却不行,提示:
java.lang.NullPointerException at com.newManage.updateDatabase(newManage.java:49)
at org.apache.jsp.userManage.saveManage_jsp._jspService(saveManage_jsp.java:94)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
at java.lang.Thread.run(Thread.java:595)
test.jsp 代码如下:
<%@ page language= 'java ' contentType= "text/html;charset=GB2312 " %>
<%@ page import= 'java.util.* '%>
<%@ page import= 'java.sql.* '%>
<%@ page import= "com.* "%>
<jsp:useBean id= 'oMD5 ' scope= 'request ' class= 'com.MD5 '/>
<html>
<body>
<%
String password = "123456 ";
String pwdmd5 = oMD5.getMD5ofStr(password); //计算MD5的值
System.out.print(pwdmd5);
%>
</body>
</html>
newManage.java代码如下:
package com;
import java.sql.*;
import db.*;
public class newManage
{
// 数据库链接类
ConnDB con= new ConnDB();
private String userid,password,qy,username,bm,job,type,info;
public void setUserid(String u){userid=u;}
public String getUserid(){return userid;}
public void setPassword(String p){password=p;}
public String getPassword(){return password;}
public void setQy(String q){qy=q;}
public String ge