<%@ page language="java" contentType="text/html;charset=utf-8" %>
<%@ page import="java.sql.*,java.util.*" %>
<%@ page import="java.text.*,javax.naming.*" %>
<% String context=request.getContextPath(); %>
<html>
<head>
<title>guestbook</title>
</head><body>
<%@ page language="java" import="java.util.*" contentType="text/html;charset=UTF-8"%><%
int result = 0;
String sql="insert into gusetbook (name,email,phone,title,content,time) values(?,?,?,?,?,?)";
String name = request.getParameter("name");
String email = request.getParameter("email");
String phone = request.getParameter("phone");
String title = request.getParameter("title");
String content = request.getParameter("content");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
String time = sdf.format(new java.util.Date());
try{
Class.forName("com.mircosoft.sqlserver.jdbc.SQLServerDriver");
Connection con=DriverManager.getConnection("jdbc:sqlserver://localhost:1434;DatabaseName=lipeihui","sa","lipeihui");
PreparedStatement pstmt = con.prepareStatement(sql);
pstmt.setString(1,"name");
pstmt.setString(2,"email");
pstmt.setString(3,"phone");
pstmt.setString(4,"title");
pstmt.setString(5,"content");
pstmt.setString(6,"time");
pstmt.executeUpdate();} catch (ClassNotFoundException e){
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
%>
</body>
</html>出现Source not found for JspServletWrapper.handleJspException(Exception) line: 476错误
<%@ page import="java.sql.*,java.util.*" %>
<%@ page import="java.text.*,javax.naming.*" %>
<% String context=request.getContextPath(); %>
<html>
<head>
<title>guestbook</title>
</head><body>
<%@ page language="java" import="java.util.*" contentType="text/html;charset=UTF-8"%><%
int result = 0;
String sql="insert into gusetbook (name,email,phone,title,content,time) values(?,?,?,?,?,?)";
String name = request.getParameter("name");
String email = request.getParameter("email");
String phone = request.getParameter("phone");
String title = request.getParameter("title");
String content = request.getParameter("content");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
String time = sdf.format(new java.util.Date());
try{
Class.forName("com.mircosoft.sqlserver.jdbc.SQLServerDriver");
Connection con=DriverManager.getConnection("jdbc:sqlserver://localhost:1434;DatabaseName=lipeihui","sa","lipeihui");
PreparedStatement pstmt = con.prepareStatement(sql);
pstmt.setString(1,"name");
pstmt.setString(2,"email");
pstmt.setString(3,"phone");
pstmt.setString(4,"title");
pstmt.setString(5,"content");
pstmt.setString(6,"time");
pstmt.executeUpdate();} catch (ClassNotFoundException e){
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
%>
</body>
</html>出现Source not found for JspServletWrapper.handleJspException(Exception) line: 476错误
一般端口都是1433难道你自己改成1434了?
<%@ page language="java" contentType="text/html;charset=utf-8" %>
这句怎么重复了两次 格式也不对呀 写成<%@ page language="java" contentType="text/html" charset="GBK" %>
pstmt.setString(1,"name");
pstmt.setString(2,"email");
pstmt.setString(3,"phone");
pstmt.setString(4,"title");
pstmt.setString(5,"content");
pstmt.setString(6,"time");
这些东西里的引号是啥意思哦?
org.apache.catalina.startup.Bootstrap at localhost:60822
Thread [main] (Running)
Daemon Thread [ContainerBackgroundProcessor[StandardEngine[Catalina]]] (Running)
Daemon Thread [http-8080-Acceptor-0] (Running)
Daemon Thread [TP-Monitor] (Running)
Daemon Thread [TP-Processor1] (Running)
Daemon Thread [TP-Processor3] (Running)
Daemon Thread [TP-Processor4] (Running)
Daemon Thread [TP-Processor2] (Running)
Daemon Thread [http-8080-1] (Suspended (exception NullPointerException))
JspServletWrapper.handleJspException(Exception) line: 476
JspServletWrapper.service(HttpServletRequest, HttpServletResponse, boolean) line: 338
JspServlet.serviceJspFile(HttpServletRequest, HttpServletResponse, String, Throwable, boolean) line: 313
JspServlet.service(HttpServletRequest, HttpServletResponse) line: 260
JspServlet(HttpServlet).service(ServletRequest, ServletResponse) line: 717
ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 290
ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 206
StandardWrapperValve.invoke(Request, Response) line: 233
StandardContextValve.invoke(Request, Response) line: 191
StandardHostValve.invoke(Request, Response) line: 127
ErrorReportValve.invoke(Request, Response) line: 102
StandardEngineValve.invoke(Request, Response) line: 109
CoyoteAdapter.service(Request, Response) line: 298
Http11Processor.process(Socket) line: 852
Http11Protocol$Http11ConnectionHandler.process(Socket) line: 588
JIoEndpoint$Worker.run() line: 489
Thread.run() line: 619
E:\Myeclipse\binary\com.sun.java.jdk.win32.x86_1.6.0.013\bin\javaw.exe (2010-6-24 下午11:33:51)
jstl + el
试一下。