📄 add_class_1.jsp
字号:
<%@ page contentType="text/html; charset=GB2312" %>
<%@ page import="java.sql.*"%>
<jsp:useBean id="DBConn" class="jspeshop.DBConn" scope="page"/>
<%
if(session.getAttribute("name")==null){
response.sendRedirect("index.jsp");
}else{
%><head>
<link href=file:///F|/eShop/jspEshop/wshop/css.css rel=STYLESHEET type=text/css>
<SCRIPT language=javascript id=clientEventHandlersJS>
//函数名:chksafe
//功能介绍:检查是否含有"'",'\\',"/"
//参数说明:要检查的字符串
//返回值:0:是 1:不是
function chksafe(a)
{
fibdn = new Array ("'" ,"\\", "、", ",", ";", "/");
i=fibdn.length;
j=a.length;
for (ii=0;ii<i;ii++)
{ for (jj=0;jj<j;jj++)
{ temp1=a.charAt(jj);
temp2=fibdn[ii];
if (temp1==temp2)
{ return 0; }
}
}
return 1;
}
//函数名:chkspc
//功能介绍:检查是否含有空格
//参数说明:要检查的字符串
//返回值:0:是 1:不是
function chkspc(a)
{
var i=a.length;
var j = 0;
var k = 0;
while (k<i)
{
if (a.charAt(k) != " ")
j = j+1;
k = k+1;
}
if (j==0)
{
return 0;
}
if (i!=j)
{ return 0; }
else
{
return 1;
}
}
//函数名:fucCheckLength
//功能介绍:检查字符串的长度
//参数说明:要检查的字符串
//返回值:长度值
function fucCheckLength(strTemp)
{
var i,sum;
sum=0;
for(i=0;i<strTemp.length;i++)
{
if ((strTemp.charCodeAt(i)>=0) && (strTemp.charCodeAt(i)<=255))
sum=sum+1;
else
sum=sum+2;
}
return sum;
}
function chkitem(str)
{
var strSource ="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_";
var ch;
var i;
var temp;
for (i=0;i<=(str.length-1);i++)
{
ch = str.charAt(i);
temp = strSource.indexOf(ch);
if (temp==-1)
{
return 0;
}
}
if (strSource.indexOf(ch)==-1)
{
return 0;
}
else
{
return 1;
}
}
</SCRIPT>
<SCRIPT language=javascript>
//正常字符
function B1_onsubmit(){
if((document.form.reTitle.value=='')||chkspc(document.form.reTitle.value)==0)
{
alert("不能包含空格。");
document.form.reTitle.focus();
return false;
}
if (chksafe(document.form.reTitle.value)==0){
alert("不能含有特殊的字符。");
document.form.reTitle.focus();
return false;
}
document.form.options.value='rename'
}
function B3_onsubmit(){
if((document.form.newTitle.value=='')||chkspc(document.form.newTitle.value)==0)
{
alert("不能包含空格。");
document.form.newTitle.focus();
return false;
}
if (chksafe(document.form.newTitle.value)==0){
alert("不能含有特殊的字符。");
document.form.newTitle.focus();
return false;
}
document.form.options.value='new'
}
</SCRIPT>
</head>
<link rel="stylesheet" type="text/css" href="../style.css">
<%
try{
System.out.println("已经登陆");
String sql="select * from Class1";
Connection con =DBConn.GetConn();
Statement st = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
ResultSet rs = st.executeQuery(sql);
%>
<body>
<table width="750" height="160" border="0">
<tr>
<td> </td>
</tr>
</table>
<table border="0" width="100%" cellspacing="1">
<tr>
<td width="100%">
<form method="POST" action="addcl1.jsp" name=form>
<input type="hidden" name="options" >
<table width="70%" border="0" align="center" cellpadding="0" cellspacing="1" bordercolor="#000000" bgcolor="#000000">
<tr>
<td bgcolor="#EBEEF3"><div align="center"><center>
<p align="center">类别:
<select name="subject" size="1"style="font-size: 9pt">
<%
if(!rs.next()){
System.out.println("没有任何的类型");
out.print("<option value=>请增加类别");
}else{
//rs.previous();//将游标移到前一行
rs.absolute(1);
System.out.println("游标移到第一行");
String name1=rs.getString("CL1_NAME");
out.print("<option value=" +name1+">" +name1+ "</option>");
while(rs.next()){
System.out.println("有类型");
name1=rs.getString("CL1_NAME");
out.print("<option value=" +name1+">" +name1+ "</option>");
}
}
%>
</select>
<input type="submit" value="删除" name="B2" onclick="form.options.value='del'" ></td>
</tr>
<tr align="center">
<td bgcolor="#EBEEF3"><br>
</td>
</tr>
<tr align="center">
<td bgcolor="#EBEEF3"><p>新名字:<input type="text" name="reTitle" size="20" class=smallinput>
<input type="submit" value="改名" name="B1" onclick="return B1_onsubmit()">
</td>
</tr>
<tr align="center">
<td bgcolor="#EBEEF3"><br>
</td>
</tr>
<tr align="center">
<td bgcolor="#EBEEF3"><p>新类别:
<input type="text" name="newTitle" size="20" class=smallinput>
<input type="submit" value="新增" name="B3" onclick="return B3_onsubmit()"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<%
}catch(Exception e){
//错误处理
throw (e);
}
%>
</body>
</html>
<%
}
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -