有一段代码有点毛病,谁指教下
<%@ page import="javax.naming.Context,javax.naming.InitialContext,java.sql.Connection,javax.sql.DataSource" %><%
request.setCharacterEncoding("GBK");
String name=request.getParameter("user");
String title=request.getParameter("title");
String ip=request.getRemoteAddr();
Context context=new InitialContext();
DataSource ds=(DataSource)context.lookup("java:comp/env/jdbc/bookstore");
Connection conn=ds.getConnection();
PreparedStatement ps=conn.prepareStatement("insert into guestbook(user,title,posttime,ip)values(?,?,now(),?)");
ps.setString(1,name);
ps.setString(2,title);
ps.setString(3,ip);
ps.executeUpdate();
%>
<jsp:forward page="guestbook.jsp"/>
符号: 类 PreparedStatement
位置: 类 org.apache.jsp.post_jsp
PreparedStatement ps=conn.prepareStatement("insert into guestbook(user,title,posttime,ip)values(?,?,ds.now(),?)");
^
1 错误
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)