错误如下:
2015-5-27 13:23:59 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet [jsp] in context with path [/drp2.0] threw exception [An exception occurred processing JSP page /sysmgr/user_maint.jsp at line 112
109: <td class="rd8"><%=user.getUserName()%></td>
110: <td class="rd8"><%=user.getContactTel()%></td>
111: <td class="rd8"><%=user.getEmail()%></td>
112: <td class="rd8"><%=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
113: .format(user.getCreateDate())%></td>
114: </tr>
115:
Stacktrace:] with root cause
java.lang.NullPointerException
at java.util.Calendar.setTime(Calendar.java:1075)
at java.text.SimpleDateFormat.format(SimpleDateFormat.java:876)
at java.text.SimpleDateFormat.format(SimpleDateFormat.java:869)
at java.text.DateFormat.format(DateFormat.java:316)
at org.apache.jsp.sysmgr.user_005fmaint_jsp._jspService(user_005fmaint_jsp.java:192)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
JSP页面代码如下:
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@page import="com.bjpowernode.drp.sysmgr.manager.*"%>
<%@page import="com.bjpowernode.drp.util.PageModel"%>
<%@page import="com.bjpowernode.drp.sysmgr.domain.*"%>
<%@page import="java.util.*"%>
<%@page import="java.text.*"%>
<%
int pageNo = 1;
int pageSize = 10;
PageModel pageModel = UserManager.getInstance().findUserList(
pageNo, pageSize);
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>用户维护</title>
<link rel="stylesheet" href="../style/drp.css">
<script type="text/javascript">
function addUser() {
window.self.location = "user_add.jsp";
}
function modifyUser() {
window.self.location = "user_modify.html";
}
function deleteUser() {
}
function checkAll(field) {
var selectFlags = document.getElementsByName("selectFlag");
for ( var i = 0; i < selectFlags.length; i++) {
selectFlags[i].checked = field.checked;
}
}
function topPage() {
}
function previousPage() {
}
function nextPage() {
}
function bottomPage() {
}
</script>
</head>
<body class="body1">
<form name="userform" id="userform">
<div align="center">
<table width="95%" border="0" cellspacing="0" cellpadding="0"
height="35">
<tr>
<td class="p1" height="18" nowrap> </td>
</tr>
<tr>
<td width="522" class="p1" height="17" nowrap><img
src="../images/mark_arrow_02.gif" width="14" height="14">
<b>系统管理>>用户维护</b>
</td>
</tr>
</table>
<hr width="100%" align="center" size=0>
</div>
<table width="95%" height="20" border="0" align="center"
cellspacing="0" class="rd1" id="toolbar">
<tr>
<td width="49%" class="rd19"><font color="#FFFFFF">查询列表</font>
</td>
<td width="27%" nowrap class="rd16">
<div align="right"></div>
</td>
</tr>
</table>
<table width="95%" border="1" cellspacing="0" cellpadding="0"
align="center" class="table1">
<tr>
<td width="55" class="rd6"><input type="checkbox" name="ifAll"
onClick="checkAll(this)">
</td>
<td width="119" class="rd6">用户代码</td>
<td width="152" class="rd6">用户名称</td>
<td width="166" class="rd6">联系电话</td>
<td width="150" class="rd6">email</td>
<td width="153" class="rd6">创建日期</td>
</tr>
<%
List userList = pageModel.getList();
for (Iterator iter = userList.iterator(); iter.hasNext();) {
User user = (User) iter.next();
%>
<tr>
<td class="rd8"><input type="checkbox" name="selectFlag"
class="checkbox1" value=<%=user.getUserId()%>>
</td>
<td class="rd8"><%=user.getUserId()%></td>
<td class="rd8"><%=user.getUserName()%></td>
<td class="rd8"><%=user.getContactTel()%></td>
<td class="rd8"><%=user.getEmail()%></td>
<td class="rd8"><%=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
.format(user.getCreateDate())%></td>
</tr>
<%
}
%>
</table>
<table width="95%" height="30" border="0" align="center"
cellpadding="0" cellspacing="0" class="rd1">
<tr>
<td nowrap class="rd19" height="2">
<div align="left">
<font color="#FFFFFF"> 共 xx 页</font>
<font color="#FFFFFF">当前第</font>  <font color="#FF0000">x</font> 
<font color="#FFFFFF">页</font>
</div>
</td>
<td nowrap class="rd19">
<div align="right">
<input name="btnTopPage" class="button1" type="button"
id="btnTopPage" value="|<< " title="首页" onClick="topPage()">
<input name="btnPreviousPage" class="button1" type="button"
id="btnPreviousPage" value=" < " title="上页"
onClick="previousPage()"> <input name="btnNextPage"
class="button1" type="button" id="btnNextPage" value=" > "
title="下页" onClick="nextPage()"> <input
name="btnBottomPage" class="button1" type="button"
id="btnBottomPage" value=" >>|" title="尾页"
onClick="bottomPage()"> <input name="btnAdd"
type="button" class="button1" id="btnAdd" value="添加"
onClick="addUser()"> <input name="btnDelete"
class="button1" type="button" id="btnDelete" value="删除"
onClick="deleteUser()"> <input name="btnModify"
class="button1" type="button" id="btnModify" value="修改"
onClick="modifyUser()">
</div>
</td>
</tr>
</table>
<p> </p>
</form>
</body>
</html>
(PS:出错行-第112行 如果不转换时间,直接写user.getCreateDate()的话,不会报这个错误)
------解决思路----------------------
<%=%> 这个标签造成的吧
里面的内容好像不能换行
你直接
<%=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(user.getCreateDate())%>
试试