神武隐攻宝宝打什么书:jbuilder2006运行无错,打war包错误

来源:百度文库 编辑:神马品牌网 时间:2024/05/08 09:09:56
jbuilder2006运行无错,打war包错误,并且只有一条错误提示:
java.lang.IllegalArgumentException: Negative time

那位大虾帮忙看看是怎么回事,其中用到了一个第三方的标签:datetimeTag,是不是这个标签的问题啊,但是程序运行正常啊!郁闷ing

user.java文件

package bookstore;

import javax.servlet.http.HttpSessionBindingListener;
import javax.servlet.http.HttpSessionBindingEvent;
import java.sql.*;
import java.text.SimpleDateFormat;
import java.util.Date;

public class User
implements HttpSessionBindingListener
{
private String userId;
private String password;
private String userName;
private String loginDatetime;

public String getPassword()
{
return password;
}

public String getUserId()
{
return userId;
}

public String getUserName()
{
return userName;
}

public void setPassword(String password)
{
this.password = password;
}

public void setUserId(String userId)
{
this.userId = userId;
}

public void setUserName(String userName)
{
this.userName = userName;
}

public void valueBound(HttpSessionBindingEvent event)
{
Connection conn = null;
String sqlStr = "insert into T_LOGIN_LOG(ID, USER_ID, DT_LOGIN) " +
" values(SEQ_LOGIN_LOG_ID.NEXTVAL,?,? )";
try
{
conn = DBConnection.getConnection();
PreparedStatement pStat = conn.prepareStatement(sqlStr);
loginDatetime = getCurrDatetimeStr(); //当前时间串
pStat.setString(1, userId);
pStat.setString(2, loginDatetime);
pStat.executeUpdate();

} catch (SQLException e)
{
e.printStackTrace();
throw new RuntimeException("用户登陆日志写入出错");

} finally
{
try
{
if (conn != null)
{
conn.close();
}
} catch (SQLException ex)
{
ex.printStackTrace();
}
}
}
/**
* 获取当前时间字串,以yyyyMMddHHmmss格式返回,如20050505010101
* @return String
*/
private static String getCurrDatetimeStr()
{
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
return sdf.format(new Date());
}
}
login.jsp文件

<%@page contentType="text/html; charset=GBK" import="bookstore.UserList"%>
<html>
<head>
<title>login</title>
</head>
<body bgcolor="#ffffff">
<form action="switch.jsp" name="form1" method="POST"> 用户名:
<select name="userId">
<option value="">--登录用户--</option>
<%=UserList.getUserListHTML()%></select>
密 码:
<input name="password" type="password"/>
<input type="submit" name="Submit" value="登录"/>
</form>
</body>
</html>