JSP高手来下!!!

来源:百度知道 编辑:UC知道 时间:2024/07/08 21:07:42
<%@page contentType="text/html;charset=gb2312"%>
<%@page import="java.sql.*"%>
<html>
<head>
<title>留言管理程序</title>
</head>
<body>
<center>
<br>
<h1>留管理范例</h1>
<%
//进入乱码处理
request.setCharacterEncoding("gb2312");
%>

<%
//接受请示的内容
String id = request.getParameter("id") ;
String name = request.getParameter("name") ;
String password = request.getParameter("password") ;
boolean f = false;
%>
<%
final String DBDRIVER="com.mysql.jdbc.Driver";
final String DBURL="jdbc:mysql://localhost:3306/orange";
final String DBUSE="root";
final String DBPASSWORD="111999";
Connection conn = null;
PreparedStatement ps =null;
%>
<%
String sql ="insert in

var name=document.getElementById("name");
if(name==null||name="")
alert("请填写用户名");

这样写更好,

土一点,但肯定能实现..if else把下面的全包起来

<%@page contentType="text/html;charset=gb2312"%>
<%@page import="java.sql.*"%>
<html>
<head>
<title>留言管理程序</title>
</head>
<body>
<center>
<br>
<h1>留管理范例</h1>
<%
//进入乱码处理
request.setCharacterEncoding("gb2312");
%>

<%
//接受请示的内容
String id = request.getParameter("id") ;
if(id!=null){

String name = request.getParameter("name") ;
String password = request.getParameter("password") ;
boolean f = false;
final String DBDRIVER="com.mysql.jdbc.Driver";
final String DBURL="jdbc:mysql://localhost:3306/orange";
final String DBUSE