兄弟们,我的的网页上有问题,帮忙看一下哦! 源代码如下: 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>注册窗口二</title></head><body bgcolor="#ccccff"><div align="center"> <P> <h1>注册窗口</h1> </p><hr></div><%-- 变量定义--%><% String userid=new String(); String userid2=new String(); String userpsw=new String(); String userpsw2=new String(); String usermail=new String(); String username=new String(); String usersex=new String(); String userwork=new String(); String temp=new String(); int n;%><%--! 从上一张页面上获得变量值 --%><% userid=request.getParameter("txtuserid"); userid2=request.getParameter("txtuserid2"); userpsw=request.getParameter("txtpassword"); userpsw2=request.getParameter("txtpassword2"); usermail=request.getParameter("txtmail"); username=request.getParameter("txtname"); usersex=request.getParameter("radsex"); userwork=request.getParameter("selwork"); n=userid.length()*userid2.length()*userpsw.length()*userpsw2.length()*usermail.length()*username.length()*usersex.length()*userwork.length();%><%-- 判断zc1.jsp这张页面有没有输入正确的变量 --%><% if(n!=0&userpsw.equals(userpsw2)){ String url=new String(); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:usergl","dpf110120","88643226"); Statement stmt=con.createStatement(); String SQL=new String();%><%-- 判断这个用户名有没有存在--%><% SQL="select * from user1 where user1='"+userid+"'"; ResultSet rs=stmt.executeQuery(SQL); int flag=1; if(rs.next()){ flag=0; } rs.close(); if(flag==1){%><%--! 向数据库中写入数据 --%><% SQL="insert into user1(id1,user1,passwords,email,names,sex,works) values('"+userid+"','"+userid2+"','"+userpsw+"','"+usermail+"','"+username+"','"+usersex+"','"+userwork+"')"; stmt.executeUpdate(SQL);%><% String SQL2=new String(); SQL2="create table"+userid+"(title text,article text)"; stmt.executeUpdate(SQL2); stmt.close(); con.close();%> <p align="center">注册成功!</p><table width="200" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="35" width="100">用户账号: </td> <td height="35" width="100"><%=userid%> </td> </tr> <tr> <td height="35" width="100">用户昵称: </td> <td height="35" width="100"><%=userid2%> </td> </tr> <tr> <td height="35" width="100">E-mail: </td> <td height="35" width="100"><%=usermail%> </td> </tr> <tr> <td height="35" width="100">姓名: </td> <td height="35" width="100"><%=username%> </td> </tr> <tr> <td height="35" width="100">性别: </td> <td height="35" width="100"><%=usersex%> </td> </tr> <tr> <td height="35" width="100">职业: </td> <td height="35" width="100"><%=userwork%> </td> </tr> </table><% } } else{%><% if(!(userpsw.equals(userpsw2))){%> <p> 密码不符! </p><% } if(n==0){%> <p> 有未添加的注册信息! </p><% }%> <p> 注册不成功! </p><%}%></div></body></html> 出错的提示如下:org.apache.jasper.JasperException: [Microsoft][ODBC SQL Server Driver][SQL Server]第 1 行: 'table1' 附近有语法错误。 那么这个table这个是在数据库中还是在那里呢?> SQL2="create table"+userid+"(title text,article text)"; add blankspaceSQL2="create table "+userid+" (title text,article text)"; "create table "+userid+"(title text,article text)";table后要有空格,你的好像是没这个 tomuno(tomuno)和wsk_228(qing_feng)说的很明白了!如果没有空格,你的语句就是这样:假如说,你的userid的值为:aaacreate tableaaa(title text,article text)你自己觉得,数据库,能识别吗? JSF bean中如何获取页面中request.setAttribute的值? java socket编程 请教数据库连接问题? 获取cookie的值 jsp设计第三版中的一些问题。50分请高手指教 请问这里的this是什么意思,请高手指点 include问题(请指点) weblogic console里的问题 servlet 类文件放哪里? 呵呵 哪位仁兄对邮件服务器熟呀, 我想问几个问题 int row_num=(int)request.getParameter("i");这句话错在那? hibernate的错误异常
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>注册窗口二</title>
</head><body bgcolor="#ccccff">
<div align="center">
<P>
<h1>注册窗口</h1>
</p>
<hr>
</div>
<%-- 变量定义--%>
<%
String userid=new String();
String userid2=new String();
String userpsw=new String();
String userpsw2=new String();
String usermail=new String();
String username=new String();
String usersex=new String();
String userwork=new String();
String temp=new String();
int n;
%>
<%--! 从上一张页面上获得变量值 --%>
<%
userid=request.getParameter("txtuserid");
userid2=request.getParameter("txtuserid2");
userpsw=request.getParameter("txtpassword");
userpsw2=request.getParameter("txtpassword2");
usermail=request.getParameter("txtmail");
username=request.getParameter("txtname");
usersex=request.getParameter("radsex");
userwork=request.getParameter("selwork");
n=userid.length()*userid2.length()*userpsw.length()*userpsw2.length()*usermail.length()*username.length()*usersex.length()*userwork.length();
%>
<%-- 判断zc1.jsp这张页面有没有输入正确的变量 --%>
<%
if(n!=0&userpsw.equals(userpsw2)){
String url=new String();
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:usergl","dpf110120","88643226");
Statement stmt=con.createStatement();
String SQL=new String();
%>
<%-- 判断这个用户名有没有存在--%>
<%
SQL="select * from user1 where user1='"+userid+"'";
ResultSet rs=stmt.executeQuery(SQL);
int flag=1;
if(rs.next()){
flag=0;
}
rs.close();
if(flag==1){
%>
<%--! 向数据库中写入数据 --%>
<%
SQL="insert into user1(id1,user1,passwords,email,names,sex,works) values('"+userid+"','"+userid2+"','"+userpsw+"','"+usermail+"','"+username+"','"+usersex+"','"+userwork+"')";
stmt.executeUpdate(SQL);
%>
<%
String SQL2=new String();
SQL2="create table"+userid+"(title text,article text)";
stmt.executeUpdate(SQL2);
stmt.close();
con.close();
%>
<p align="center">注册成功!</p>
<table width="200" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="35" width="100">用户账号: </td>
<td height="35" width="100"><%=userid%> </td>
</tr>
<tr>
<td height="35" width="100">用户昵称: </td>
<td height="35" width="100"><%=userid2%> </td>
</tr>
<tr>
<td height="35" width="100">E-mail: </td>
<td height="35" width="100"><%=usermail%> </td>
</tr>
<tr>
<td height="35" width="100">姓名: </td>
<td height="35" width="100"><%=username%> </td>
</tr>
<tr>
<td height="35" width="100">性别: </td>
<td height="35" width="100"><%=usersex%> </td>
</tr>
<tr>
<td height="35" width="100">职业: </td>
<td height="35" width="100"><%=userwork%> </td>
</tr>
</table>
<%
}
}
else{
%>
<%
if(!(userpsw.equals(userpsw2))){
%>
<p>
密码不符!
</p>
<%
}
if(n==0){
%>
<p>
有未添加的注册信息!
</p>
<%
}
%>
<p>
注册不成功!
</p>
<%
}
%>
</div>
</body>
</html>
org.apache.jasper.JasperException: [Microsoft][ODBC SQL Server Driver][SQL Server]第 1 行: 'table1' 附近有语法错误。
add blankspace
SQL2="create table "+userid+" (title text,article text)";
table后要有空格,你的好像是没这个