关于HTTP Status 500 的报错问题!在线等
我尝试着写了一个功能运用了spring但是出了500的错误 哪位给指点一下啊
JSP文件
<%@ page language="java" pageEncoding="GB18030"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link href="../css/css1.css" rel="stylesheet" type="text/css" />
<%
com.longxin.util.ErrorCheck ec = new com.longxin.util.ErrorCheck();
ec.setFormName("anliForm");
ec.lengthCheck("title","标题不能为空并在100字内",1,200);
ec.lengthCheck("content","内容不能为空并在2000字内",1,4000);
ec.checkSubmits();
out.println(ec.ErrorCheckScript());
%>
</head>
<body>
<table width="95%" height="25" border="0" align="center" cellpadding="0" cellspacing="0" class="table1" >
<tr>
<td><img src="../admin/images/ck.gif" width="16" height="21" /> 添加应聘信息</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
</table>
<table width="76%" border="0" align="center" cellpadding="0" cellspacing="2" class="table">
<tbody>
</tbody>
<html:form action="/yingPin" onsubmit="return errorCheck();">
<tr >
<td width="24%" height="25" align="center" bgcolor="#d7dfea">应聘职位:</td>
<td width="76%" height="25" align="left" bgcolor="#EEF1F7"><html:text property="YINGPIN_ZHIWEI" onfocus="calendar()"/>
<html:errors property="YINGPIN_ZHIWEI" /></td>
</tr>
<tr >
<td height="25" align="center" bgcolor="#d7dfea">姓名:</td>
<td height="25" align="left" bgcolor="#EEF1F7"><html:text property="NAME"/><html:errors property="NAME"/>
</td>
</tr>
<tr >
<td height="25" align="center" bgcolor="#d7dfea">性别:</td>
<td height="25" align="left" bgcolor="#EEF1F7">
<html:text property="SEX" size="30"/><html:errors property="SEX"/></td>
</tr>
<tr >
<td height="25" align="center" bgcolor="#d7dfea">年龄:</td>
<td height="25" align="left" bgcolor="#EEF1F7"><html:text property="AGE" size="30"/><html:errors property="AGE"/></td>
</tr>
<tr >
<td height="25" align="center" bgcolor="#d7dfea">学历:</td>
<td height="25" align="left" bgcolor="#EEF1F7">
<html:text property="EDU" size="30"/><html:errors property="EDU"/></td>
</tr>
<tr >
<td height="25" align="center" bgcolor="#d7dfea">居住地址:</td>
<td height="25" align="left" bgcolor="#EEF1F7"><html:text property="ADDRESS" size="30"/><html:errors property="ADDRESS"/></td>
</tr>
<tr >
<td height="25" align="center" bgcolor="#d7dfea">联系电话:</td>
<td height="25" align="left" bgcolor="#EEF1F7"><html:text property="PHONE" size="30"/><html:errors property="PHONE"/></td>
</tr>
<tr>
<td height="25" align="center" bgcolor="#d7dfea">邮箱:</td>
<td height="25" align="left" bgcolor="#EEF1F7"><html:text property="EMAIL" size="30"/><html:errors property="EMAIL"/> </td>
</tr>
<tr>
<td height="25" align="center" bgcolor="#d7dfea">发布日期:</td>
<td height="25" align="left" bgcolor="#EEF1F7"><html:text property="PUBLISH_DATETIME" size="30"/><html:errors property="PUBLISH_DATETIME"/> </td>
</tr>
<tr >
<td height="40" colspan="2" align="center" bgcolor="#EEF1F7">
<html:submit value="提交"/>
<html:reset value="重置"/> </tr>
</html:form>
</table>
</body>
</html>
JAVA文件
/**
*
*/
package com.longxin.struts.action.zhaoPin;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.longxin.dao.zhaoPin.YingpinDAO;
import com.longxin.dao.zhaoPin.ZhaopinDAO;
import com.longxin.struts.form.yingPin.YingPinForm;
import com.longxin.util.StringtoDate;
import com.longxin.vo.zhaoPin.Yingpin;
import com.longxin.vo.zhaoPin.Zhaopin;
public class YingPinAction extends Action
{
private YingpinDAO yingpinDao;
private ZhaopinDAO zhaopinDao;
public ZhaopinDAO getZhaopinDao() {
return zhaopinDao;
}
public void setZhaopinDao(ZhaopinDAO zhaopinDao) {
this.zhaopinDao = zhaopinDao;
}
public YingpinDAO getYingpinDao() {
return yingpinDao;
}
public void setYingpinDao(YingpinDAO yingpinDao) {
this.yingpinDao = yingpinDao;
}
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response){
YingPinForm yingPinForm = (YingPinForm) form;
Yingpin yingPin=new Yingpin();
StringtoDate stringtoDate=new StringtoDate();
//取得页面参数zhaoPinListID
Integer zhaopinListID = Integer.parseInt(request.getParameter("zhaoPinListID"));
//根据参数zhaoPinListID,取得相应记录
Zhaopin zhaopin = zhaopinDao.findById(zhaopinListID);
Date publishDatetime;
//发布日期若为空,则初始化日期,若不为空,则进行日期转换处理
if(yingPinForm.getPUBLISH_DATETIME().trim()==null || "".equals(yingPinForm.getPUBLISH_DATETIME().trim()))
publishDatetime=new Date();
else
publishDatetime=stringtoDate.parseDate(yingPinForm.getPUBLISH_DATETIME().trim());
yingPin.setPublishDatetime(publishDatetime);
yingPin.setYingpinZhiwei(zhaopin.getZhaopinZhiwei());
yingPin.setName(yingPinForm.getNAME());
yingPin.setSex(yingPinForm.getSEX());
yingPin.setAge(yingPinForm.getAGE());
yingPin.setEdu(yingPinForm.getEDU());
yingPin.setAddress(yingPinForm.getADDRESS());
yingPin.setPhone(yingPinForm.getPHONE());
yingPin.setEmail(yingPinForm.getEMAIL());
try{
yingpinDao.save(yingPin);
//持久化成功,进行跳转
return mapping.findForward("success");
}catch (RuntimeException e){
throw(e);
}
}
}
[解决办法]
错误信息呢?
[解决办法]
错误代码呢
[解决办法]
Integer zhaopinListID = Integer.parseInt(request.getParameter("zhaoPinListID"));
zhaoPinListID这个属性哪儿来的,可能就是这个错,debug下。
[解决办法]
空指针
java.lang.NullPointerException
com.longxin.struts.action.zhaoPin.YingPinAction.execute(YingPinAction.java:65)
你看看YingPinAction.java 这文件的 65行
用DEBUG 跟踪下 看65行传了一个NULL进来了