it's clearly : "java.lang.NullPointerException"
maybe the object is not a instance
maybe the object is not a instance
解决方案 »
- CAS SSO单点登录认证相关
- java 和 smartfoxserver
- jsp 高级问题 (动态为文件添加代码)
- 运行tomcat,经常出现这样的错误,为什么
- ■高分■十万火急■■想问一下先类似CSDN的这种树型导航在JSP中是怎么实现的?
- 一个关于日期的问题
- 100分求讨论!高手都进来讨论讨论吧,关于Session的实现机制!!!!!!
- 关于上传文件异常com.jspsmart.upload.SmartUploadException: Unable to upload.请高手指点!!!
- 我的 ChartBuilder3.0 (JSP版) 图形报表生成工具 发布 送分!
- JDBC连ORACLE数据库问题。
- java编译不了,什么原因?急!!!
- 关于IE的记忆问题
例如:
String s = null;
s.ToString();
这样就会跑空指针了!
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import com.jspsmart.upload.*;
import oilmis.orig.rcbg.vo.GeduVO;
import oilmis.orig.rcbg.JB.GeduJ2E;public class GeduServlet
extends HttpServlet {
private ServletConfig config;
/**
* init the servlet
* @throws ServletException
*/
public void init(ServletConfig config) throws ServletException {
this.config = config;
}
final public ServletConfig getServletConfig() {
return config;
} public void doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
doProcess(request, response);
} public void doPost(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
doProcess(request, response);
} public void doProcess(HttpServletRequest request,
HttpServletResponse response) throws ServletException,
IOException {
if(request.getParameter("dotype").equals("add")){
Integer dig = new Integer(100);
java.util.Calendar myC = java.util.Calendar.getInstance();
Long ts = new Long(myC.getInstance().getTimeInMillis());
String postFix = new String();
postFix = ts.toString();
com.jspsmart.upload.SmartUpload mySmartUpload = new com.jspsmart.upload.SmartUpload();
String zzjyBt = new String(request.getParameter("zzjyBt").getBytes(
"iso-8859-1"), "gb2312");
String zzjyBh = new String(request.getParameter("zzjyBh").getBytes(
"iso-8859-1"), "gb2312");
String zzjyNr = new String(request.getParameter("zzjyNr").getBytes(
"iso-8859-1"), "gb2312");
String zzjyBz = new String(request.getParameter("zzjyBz").getBytes(
"iso-8859-1"), "gb2312");
String str_time = new String(request.getParameter("zzjyRq"));
java.sql.Date zzjyRq = java.sql.Date.valueOf(str_time);
GeduVO vo = new GeduVO();
try {
//初始化
mySmartUpload.initialize(config, request, response);
mySmartUpload.setTotalMaxFileSize(10000000);
//上载文件
mySmartUpload.upload();
//取得上载的文件
com.jspsmart.upload.File myFile = mySmartUpload.getFiles().getFile(0);
if (!myFile.isMissing()) {
//取得上载的文件的文件名
String myFileName = myFile.getFileName();
String suffix = myFileName.substring(myFileName.lastIndexOf('.'));
//保存路径
String trace = "c:/upload/rcbg/zzjy/" + postFix + suffix;
//将文件保存在服务器端
myFile.saveAs(trace, mySmartUpload.SAVE_PHYSICAL);
//将数据填入数据视图
vo.setBgZzjyId(ts);
vo.setZzjyBh(zzjyBh);
vo.setZzjyBt(zzjyBt);
vo.setZzjyNr(zzjyNr);
vo.setZzjyBz(zzjyBz);
vo.setZzjyRq(zzjyRq);
vo.setZzjyWjm(trace);
GeduJ2E geduJ2E = new GeduJ2E();
//插入数据库
Long recId = geduJ2E.createNewRec(vo, "1000");
//判断执行情况
if (recId != null) {
response.sendRedirect("/oilmis/controlServlet?recId=" + recId +
"&workFldeId=1&sysElmId=2");
return;
}
else {
System.out.println("fail!");
} }
}
catch (Exception e) {
System.out.println(e.toString());
}
}//endif
public void destroy() {
}
}