新手求助 JSP连接数据库显示的地方该怎么写
<%@ page language="java" import="java.util.*,java.sql.*"
pageEncoding="gbk"%>
<%
//GetDBConnect db = null;
Statement stmt = null;
Connection con = null;
ResultSet rs = null;
String sql = "";
String m = (String) request.getParameter("select");
try {
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager
.getConnection("jdbc:mysql://localhost/ch01?user=root&password=19890921");
stmt = con.createStatement();
System.out.println("数据库连接成功");
} catch (ClassNotFoundException e) {
System.out.println("类路径没有找着");
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
e.getNextException();
}
//ResultSet rs = null;
//stmt=conn.createStatement();
//String m = request.getParameter("select");
//db = new GetDBConnect();
//db.Connect();
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>你查询的返回结果</title>
</head>
<body>
您查询返回的结果为
<br>
<table border="1" cellpadding="0" cellspacing="0">
相关问答:
我是用STRUTS ,做了一个JSP页面,提交后没有存入数据库。
JSP代码如下:
aa.jsp代码
<%@ page contentType="text/html;charset=gb2312" language="java"%>
<%@ taglib uri=" ......
问题描述:
例如我要显示的内容如下所示
一级目录1
一级目录1子类1
子类1
一级目录1子类2
......
一个JSP页面接收其他页面提交过来的FORM表单,但是要求只接收当前站点及其子站点提交过来的FORM表单,其他站点提交过来的表单不接收,这个怎么设置?
用过滤器
filter
将当前站点及其子站点放一个目录
然 ......
<html><head><title>[@title]</title>
<meta http-equiv=Content-Type content="text/html; charset=gb2312">
<script language='javascript'>
function diyCheck ......
这是错误信息,严重: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 33 in the jsp file: /WebRo ......