主题:请教各位!!!!!多费心!
我编写了一个文档,在运行是有一个if语句在进行添加文件时总也添加不上!所以请各位帮忙看看这个文档错误的地方!非常感谢!用星号标示的便是出问题的地方!!!!!!!!!!!
<!-- 添加管理员账号 -->
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"errorPage="/public/error.jsp" %>
<jsp:useBean id="conn" scope="page" class="test.ConnSQLServer"/>
<%!
String username="";
String truename="";
String password="";
String priv="";
String oper="";
String sql="";
int result=0;
%>
<html>
<head>
<title>权限管理</title>
<link rel="stylesheet" href="../public/style.css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head>
<body class="ss">
<center>
<%
request.setCharacterEncoding("gb2312");
username=request.getParameter("loginname");
truename=request.getParameter("truename");
password=request.getParameter("password");
priv=request.getParameter("priv");
********************************************************************
//避免用户直接在地址栏输入地址所产生的异常
if(username == null||username.equals("")){
out.println("<center>");
out.println("请进行合法的操作!");
out.println("</center>");
return;
}
***********************************************************************
try{
sql="insert into Test_Admin values('"+username+"'";
sql+=",'"+truename+"'";
sql+=",'"+password+"'";
sql+=","+priv+")";
result=conn.executeUpdate(sql);
}catch(Exception ee){
out.println("<center>");
out.println("管理员账号更新失败!<br>
out.println("请将下列信息告知管理员!<br><br>");
out.println(ee.toString()+"<br><br>");
out.println("单击此处<a href=javascript:history.back()>返回</a><br>");
out.println("</center>");
}
%>
<jsp:forward page="accountmanager.jsp"/>
</center>
</body>
</html>
[color=800000][/color]
<!-- 添加管理员账号 -->
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"errorPage="/public/error.jsp" %>
<jsp:useBean id="conn" scope="page" class="test.ConnSQLServer"/>
<%!
String username="";
String truename="";
String password="";
String priv="";
String oper="";
String sql="";
int result=0;
%>
<html>
<head>
<title>权限管理</title>
<link rel="stylesheet" href="../public/style.css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head>
<body class="ss">
<center>
<%
request.setCharacterEncoding("gb2312");
username=request.getParameter("loginname");
truename=request.getParameter("truename");
password=request.getParameter("password");
priv=request.getParameter("priv");
********************************************************************
//避免用户直接在地址栏输入地址所产生的异常
if(username == null||username.equals("")){
out.println("<center>");
out.println("请进行合法的操作!");
out.println("</center>");
return;
}
***********************************************************************
try{
sql="insert into Test_Admin values('"+username+"'";
sql+=",'"+truename+"'";
sql+=",'"+password+"'";
sql+=","+priv+")";
result=conn.executeUpdate(sql);
}catch(Exception ee){
out.println("<center>");
out.println("管理员账号更新失败!<br>
out.println("请将下列信息告知管理员!<br><br>");
out.println(ee.toString()+"<br><br>");
out.println("单击此处<a href=javascript:history.back()>返回</a><br>");
out.println("</center>");
}
%>
<jsp:forward page="accountmanager.jsp"/>
</center>
</body>
</html>
[color=800000][/color]