JSP:设计一个手机销售网页并实现后台管理功能

1前台页面

JSP:设计一个手机销售网页并实现后台管理功能

2.重要步骤

树形菜单的实现:

tree.jsp

<%@ page contentType="text/html;charset=GB2312" %>

<HTML>

<head>

<link rel="StyleSheet" href="dtree.css" type="text/css" />

<script type="text/javascript" src="dtree.js"></script>

</head>

<BODY><font size=5>

<b>后台管理</b>

<div class="dtree">

<p><a href="javascript: d.openAll();">open all</a> | <a href="javascript: d.closeAll();">close all</a></p>

<script type="text/javascript">

d = new dTree('d');

d.add(0,-1,'后台管理系统');

 

d.add(1,0,'<FONT size=4>用户管理</FONT>');

d.add(2,1,'<a href="userAdd.jsp" target="right"><FONT size=4>添加用户</FONT></a>');

d.add(3,1,'<a href="userDelete.jsp" target="right"><FONT size=4>删除用户</FONT></a>');

 

d.add(5,0,'<FONT size=4>产品管理');

d.add(6,5,'<a href="productAdd.jsp" target="right"><FONT size=4>添加产品</FONT></a>');

d.add(7,5,'<a href="productDelete.jsp" target="right"><FONT size=4>删除产品</FONT></a>');

 

d.add(9,0,'<FONT size=4>产品分类');

d.add(10,9,'<a href="classifyAdd.jsp" target="right"><FONT size=4>添加类型</FONT></a>');

d.add(11,9,'<a href="classifyDelete.jsp" target="right"><FONT size=4>删除类型</FONT></a>');

 

d.add(13,0,'<FONT size=4>订单管理');

d.add(14,13,'<a href="orderAdd.jsp" target="right"><FONT size=4>添加订单</FONT></a>');

d.add(15,13,'<a href="orderDelete.jsp" target="right"><FONT size=4>删除订单</FONT></a>');

 

d.add(17,0,'<a href="index.jsp" target ="_top"><FONT size=4>返回主页</FONT></a>');

document.write(d);

</script>

</div>

</font>

</BODY>

</HTML>

 

用户的添加

添加原理:userAdd.jsp提交新的记录到newUser.jsp页面,该页面调用AddUserRecord.tag文件添加新的记录到user表,从而实现user表的添加。

QueryTag.tag:别的页面通过提交数据库名,表名,用户名,密码可以浏览表的内容

<%@tag pageEncoding="GB2312"%>

<%@tag import="java.sql.*"%>

<%@attribute name="dataBaseName" required="true"%>

<%@attribute name="tableName" required="true"%>

<%@attribute name="user" required="true"%>

<%@attribute name="password" required="false"%>

<%@variable name-given="biao" scope="AT_END"%>

<%@variable name-given="queryResult" scope="AT_END"%>

<% StringBuffer result;

       result=new StringBuffer();

      try{ Class.forName("com.mysql.jdbc.Driver");

        }

catch(Exception e){

result.append("请输入正确的用户名和密码");

}

Connection con;

Statement sql;

ResultSet rs;

try{ result.append("<table border=1>");

       String uri="jdbc:mysql://127.0.0.1/"+dataBaseName;

      con=DriverManager.getConnection(uri,user,password);

      DatabaseMetaData metadata=con.getMetaData();

      ResultSet rs1=metadata.getColumns(null,null,tableName,null);

     int 字段个数=0;

     result.append("<tr>");

    while(rs1.next()){

    字段个数++;

   String clumnName=rs1.getString(4);

   result.append("<td>"+clumnName+"</td>");

   }

result.append("</tr>");

sql=con.createStatement();

rs=sql.executeQuery("SELECT * FROM "+tableName);

  while(rs.next()){

result.append("<tr>");

for(int k=1;k<=字段个数;k++)

result.append("<td>"+rs.getString(k)+"</td>");

result.append("</tr>");

}

result.append("</table>");

con.close();

}

catch(SQLException e){

result.append("请输入正确的用户名和密码");

}

jspContext.setAttribute("queryResult",new String(result));

jspContext.setAttribute("biao",tableName);

%>

userAdd.jsp

<%@page contentType="text/html;charset=gb2312"%>

<%@taglib tagdir="/WEB-INF/tags" prefix="inquire"%>

<HTML><BODY bgcolor=pink><FONT size=3>

<FORM action="newUser.jsp" method=post>

添加新纪录:

<table border=1>

<tr><td>用户名:</td><td><Input type="text" name="logname"></td></tr>

<tr><td>密码:</td><td><Input type="text" name="password"></td></tr>

<tr><td>电话:</td><td><Input type="text" name="phone"></td></tr>

<tr><td>邮箱地址:</td><td><Input type="text" name="address"></td></tr>

<tr><td>真实名字:</td><td><Input type="text" name="realname"></td></tr>

</table>

<BR><input type="submit" name="b" value="提交">

<BR>user表添加新纪录之前的记录是:

<inquire:QueryTag dataBaseName="mobileshop"

                                tableName="user"

                              user="root" password="" />

   <BR><%=queryResult%>

<td><A href="index.jsp"><font size=2>返回主页</font></A></td>

</FONT></BODY></HTML>

AddUserRecord.jsp

<%@tag pageEncoding="GB2312"%>

<%@tag import="java.sql.*"%>

<%@attribute name="logname" required="true"%>

<%@attribute name="password" required="true"%>

<%@attribute name="phone" required="true"%>

<%@attribute name="address" required="true"%>

<%@attribute name="realname" required="true"%>

<% String condition="INSERT INTO user VALUES"+

          "("+"'"+logname+"','"+password+"','"+phone+"','"+address+"','"+realname+"')";

try{ Class.forName("com.mysql.jdbc.Driver");

        }

catch(Exception e){}

Connection con;

Statement sql;

ResultSet rs;

try{

       String uri="jdbc:mysql://127.0.0.1/mobileshop?"+

       "user=root&password=&characterEncoding=gb2312";

      con=DriverManager.getConnection(uri);

     sql=con.createStatement();

     sql.executeUpdate(condition);

     con.close();

 }

catch(Exception e){

   out.print(""+e);

}

%>

newUser.jsp

<%@page contentType="text/html;charset=gb2312"%>

<%@taglib tagdir="/WEB-INF/tags" prefix="inquire"%>

<HTML><BODY bgcolor=pink><FONT size=2>

<%!

String handleStr(String s){

try{

byte bb[]=s.getBytes("iso-8859-1");

return new String(bb);

}

catch(Exception exp){}

return s;

}

%>

<% String log=handleStr(request.getParameter("logname"));

String pass=handleStr(request.getParameter("password"));

String ph=handleStr(request.getParameter("phone"));

String add=handleStr(request.getParameter("address"));

String real=handleStr(request.getParameter("realname"));

%>

<inquire:AddUserRecord logname="<%=log%>" password="<%=pass%>"

                                  phone="<%=ph%>" address="<%=add%>" realname="<%=real%>" />

<BR>user表添加新记录后的记录是:

<inquire:QueryTag dataBaseName="mobileshop"

                                tableName="user"

                              user="root" password="" />

   <BR><%=queryResult%>

<BR><td><A href="index.jsp"><font size=2>返回主页</font></A></td>

</FONT></BODY></HTML>

AddUserRecord.tag

<%@tag pageEncoding="GB2312"%>

<%@tag import="java.sql.*"%>

<%@attribute name="logname" required="true"%>

<%@attribute name="password" required="true"%>

<%@attribute name="phone" required="true"%>

<%@attribute name="address" required="true"%>

<%@attribute name="realname" required="true"%>

<% String condition="INSERT INTO user VALUES"+

          "("+"'"+logname+"','"+password+"','"+phone+"','"+address+"','"+realname+"')";

try{ Class.forName("com.mysql.jdbc.Driver");

        }

catch(Exception e){}

Connection con;

Statement sql;

ResultSet rs;

try{

       String uri="jdbc:mysql://127.0.0.1/mobileshop?"+

       "user=root&password=&characterEncoding=gb2312";

      con=DriverManager.getConnection(uri);

     sql=con.createStatement();

     sql.executeUpdate(condition);

     con.close();

 }

catch(Exception e){

   out.print(""+e);

}

%>

 

用户的删除

userDelete.jsp

<%@page contentType="text/html;charset=GB2312"%>

<%@taglib tagdir="/WEB-INF/tags" prefix="inquire"%>

<HTML><BODY bgcolor=pink><FONT size=3>

<FORM action="deleteUser.jsp" method=post>

删除记录:<BR>输入您希望删除的用户名:

<INPUT type="text" name="name" size=10>

<BR><Input type="submit" name="b" value="提交">

<BR>被删除前的用户表:

<inquire:QueryTag dataBaseName="mobileshop"

                               tableName="user"

                             user="root" password="" />

<BR><%=queryResult%>

</FONT></BODY></HTML>

deleteUser.jsp

<%@page contentType="text/html;charset=gb2312"%>

<%@taglib tagdir="/WEB-INF/tags" prefix="inquire"%>

<HTML><BODY bgcolor=pink><FONT size=2>

<% String na=request.getParameter("name");

       if(na==null)

        na="";

      byte []bb=na.getBytes("iso-8859-1");

       na=new String(bb);

%>

<inquire:DelUserRecord name="<%=na%>" />

<BR>user表删除记录后:

<inquire:QueryTag dataBaseName="mobileshop"

                                tableName="user"

                              user="root" password="" />

   <BR><%=queryResult%>

<BR><td><A href="index.jsp"><font size=2>返回主页</font></A></td>

</FONT></BODY></HTML>

DelUserRecord.tag

<%@tag pageEncoding="GB2312"%>

<%@tag import="java.sql.*"%>

<%@attribute name="name" required="true"%>

<%String condition=

"DELETE FROM user WHERE logname= '"+name+"'";

try{ Class.forName("com.mysql.jdbc.Driver");

}

catch(Exception e){}

Connection con;

Statement sql;

ResultSet rs;

try{ String uri="jdbc:mysql://localhost/mobileshop?"+

"user=root&password=&characterEncoding=GB2312";

con=DriverManager.getConnection(uri);

con=DriverManager.getConnection(uri,"root","");

sql=con.createStatement();

sql.executeUpdate(condition);

con.close();

}

catch(Exception e){

out.print(""+e);

}

%>

 

产品管理

添加产品

productAdd.jsp

<%@page contentType="text/html;charset=gb2312"%>

<%@taglib tagdir="/WEB-INF/tags" prefix="inquire"%>

<HTML><BODY bgcolor=pink><FONT size=3>

<FORM action="newProduct.jsp" method=post>

添加新纪录:

<table border=1>

<tr><td>手机编码:</td><td><Input type="text" name="mobile_version"></td></tr>

<tr><td>手机名字:</td><td><Input type="text" name="mobile_name"></td></tr>

<tr><td>生产公司:</td><td><Input type="text" name="mobile_made"></td></tr>

<tr><td>手机价格:</td><td><Input type="text" name="mobile_price"></td></tr>

<tr><td>手机特色:</td><td><Input type="text" name="mobile_mess"></td></tr>

 <tr><td>手机图片:</td><td><Input type="text" name="mobile_pic"></td></tr>

<tr><td>序号:</td><td><Input type="text" name="id"></td></tr>

</table>

<BR><input type="submit" name="b" value="提交">

<BR>mobileform表添加新纪录之前的记录是:

<inquire:QueryTag dataBaseName="mobileshop"

                                tableName="mobileform"

                              user="root" password="" />

   <BR><%=queryResult%>

</FONT></BODY></HTML>

newProduct.jsp

<%@page contentType="text/html;charset=gb2312"%>

<%@taglib tagdir="/WEB-INF/tags" prefix="inquire"%>

<HTML><BODY bgcolor=pink><FONT size=2>

<%!

String handleStr(String s){

try{

byte bb[]=s.getBytes("iso-8859-1");

return new String(bb);

}

catch(Exception exp){}

return s;

}

%>

<% String version=handleStr(request.getParameter("mobile_version"));

String name=handleStr(request.getParameter("mobile_name"));

String made=handleStr(request.getParameter("mobile_made"));

String price=handleStr(request.getParameter("mobile_price"));

String mess=handleStr(request.getParameter("mobile_mess"));

String pic=handleStr(request.getParameter("mobile_pic"));

String id=handleStr(request.getParameter("id"));

%>

<inquire:AddProductRecord mobile_version="<%=version%>" mobile_name="<%=name%>"

                                  mobile_made="<%=made%>" mobile_price="<%=price%>"

mobile_mess="<%=mess%>" mobile_pic="<%=pic%>"

                                    id="<%=id%>" />

<BR>mobile_form表添加新记录后的记录是:

<inquire:QueryTag dataBaseName="mobileshop"

                                tableName="mobileform"

                              user="root" password="" />

   <BR><%=queryResult%>

<BR><td><A href="index.jsp"><font size=2>返回主页</font></A></td>

</FONT></BODY></HTML>

AddProductRecord.tag

<%@tag pageEncoding="GB2312"%>

<%@tag import="java.sql.*"%>

<%@attribute name="mobile_version" required="true"%>

<%@attribute name="mobile_name" required="true"%>

<%@attribute name="mobile_made" required="true"%>

<%@attribute name="mobile_price" required="true"%>

<%@attribute name="mobile_mess" required="true"%>

<%@attribute name="mobile_pic" required="true"%>

<%@attribute name="id" required="true"%>

<%

  String condition="INSERT INTO mobileform VALUES"+

          "("+"'"+mobile_version+"','"+mobile_name+"','"+mobile_made+"','"+mobile_price+"','"+mobile_mess+"','"+mobile_pic+"','"+id+"')";

try{ Class.forName("com.mysql.jdbc.Driver");

        }

catch(Exception e){}

Connection con;

Statement sql;

ResultSet rs;

try{

       String uri="jdbc:mysql://127.0.0.1/mobileshop?"+

       "user=root&password=&characterEncoding=gb2312";

      con=DriverManager.getConnection(uri);

     sql=con.createStatement();

     sql.executeUpdate(condition);

     con.close();

 }

catch(Exception e){

   out.print(""+e);

}

%>

 

删除产品

productDelete.jsp

<%@page contentType="text/html;charset=GB2312"%>

<%@taglib tagdir="/WEB-INF/tags" prefix="inquire"%>

<HTML><BODY bgcolor=pink><FONT size=3>

<FORM action="deleteProduct.jsp" method=post>

删除记录:<BR>输入您希望删除的产品名称:

<INPUT type="text" name="name" size=10>

<BR><Input type="submit" name="b" value="提交">

<BR>被删除前的产品表:

<inquire:QueryTag dataBaseName="mobileshop"

                               tableName="mobileform"

                             user="root" password="" />

<BR><%=queryResult%>

</FONT></BODY></HTML>

deleteProduct.jsp

<%@page contentType="text/html;charset=gb2312"%>

<%@taglib tagdir="/WEB-INF/tags" prefix="inquire"%>

<HTML><BODY bgcolor=pink><FONT size=3>

<% String na=request.getParameter("name");

       if(na==null)

        na="";

      byte []bb=na.getBytes("iso-8859-1");

       na=new String(bb);

%>

<inquire:DelProductRecord name="<%=na%>" />

<BR>mobileform表删除记录后:

<inquire:QueryTag dataBaseName="mobileshop"

                                tableName="mobileform"

                              user="root" password="" />

   <BR><%=queryResult%>

 <td><A href="index.jsp"><font size=2>主页</font></A></td>

</FONT></BODY></HTML>

DelProductRecord.tag

<%@tag pageEncoding="GB2312"%>

<%@tag import="java.sql.*"%>

<%@attribute name="name" required="true"%>

<%String condition=

"DELETE FROM mobileform WHERE mobile_name= '"+name+"'";

try{ Class.forName("com.mysql.jdbc.Driver");

}

catch(Exception e){}

Connection con;

Statement sql;

ResultSet rs;

try{ String uri="jdbc:mysql://localhost/mobileshop?"+

"user=root&password=&characterEncoding=GB2312";

con=DriverManager.getConnection(uri);

con=DriverManager.getConnection(uri,"root","");

sql=con.createStatement();

sql.executeUpdate(condition);

con.close();

}

catch(Exception e){

out.print(""+e);

}

%>

 

分类管理

添加分类

classifyAdd.jsp

<%@page contentType="text/html;charset=gb2312"%>

<%@taglib tagdir="/WEB-INF/tags" prefix="inquire"%>

<HTML><BODY bgcolor=pink><FONT size=3>

<FORM action="newClassify.jsp" method=post>

添加新纪录:

<table border=1>

<tr><td>序号       :</td><td><Input type="text" name="id"></td></tr>

<tr><td>分类类型:</td><td><Input type="text" name="name"></td></tr>  

</table>

<BR><input type="submit" name="b" value="提交">

<BR>分类表添加新纪录之前的记录是:

<inquire:QueryTag dataBaseName="mobileshop"

                                tableName="mobileClassify"

                              user="root" password="" />

   <BR><%=queryResult%>

</FONT></BODY></HTML>

newClassify.jsp

<%@page contentType="text/html;charset=gb2312"%>

<%@taglib tagdir="/WEB-INF/tags" prefix="inquire"%>

<HTML><BODY bgcolor=pink><FONT size=2>

<%!

String handleStr(String s){

try{

byte bb[]=s.getBytes("iso-8859-1");

return new String(bb);

}

catch(Exception exp){}

return s;

}

%>

<% String identify=handleStr(request.getParameter("id"));

String na=handleStr(request.getParameter("name"));

%>

<inquire:AddClassifyRecord id="<%=identify%>" name="<%=na%>" />

<BR>分类表添加新记录后的记录是:

<inquire:QueryTag dataBaseName="mobileshop"

                                tableName="mobileClassify

"

                              user="root" password="" />

   <BR><%=queryResult%>

<BR><td><A href="index.jsp"><font size=2>返回主页</font></A></td>

</FONT></BODY></HTML>

AddClassifyRecord.tag

<%@tag pageEncoding="GB2312"%>

<%@tag import="java.sql.*"%>

<%@attribute name="id" required="true"%>

<%@attribute name="name" required="true"%>

<% String condition="INSERT INTO mobileClassify VALUES"+

          "("+"'"+id+"','"+name+"')";

try{ Class.forName("com.mysql.jdbc.Driver");

        }

catch(Exception e){}

Connection con;

Statement sql;

ResultSet rs;

try{

       String uri="jdbc:mysql://127.0.0.1/mobileshop?"+

       "user=root&password=&characterEncoding=gb2312";

      con=DriverManager.getConnection(uri);

     sql=con.createStatement();

     sql.executeUpdate(condition);

     con.close();

 }

catch(Exception e){

   out.print(""+e);

}

%>

删除分类

classifyDelete.jsp

<%@page contentType="text/html;charset=GB2312"%>

<%@taglib tagdir="/WEB-INF/tags" prefix="inquire"%>

<HTML><BODY bgcolor=pink><FONT size=3>

<FORM action="deleteClassify.jsp" method=post>

删除记录:<BR>输入您希望删除的分类的序号:

<INPUT type="text" name="id" size=10>

<BR><Input type="submit" name="b" value="提交">

<BR>被删除前的分类表:

<inquire:QueryTag dataBaseName="mobileshop"

                               tableName="mobileClassify"

                             user="root" password="" />

<BR><%=queryResult%>

</FONT></BODY></HTML>

deleteClassify.jsp

<%@page contentType="text/html;charset=gb2312"%>

<%@taglib tagdir="/WEB-INF/tags" prefix="inquire"%>

<HTML><BODY><FONT size=3>

<% String identify=request.getParameter("id");

       if(identify==null)

        identify="";

      byte []bb=identify.getBytes("iso-8859-1");

       identify=new String(bb);

%>

<inquire:DelClassifyRecord id="<%=identify%>" />

<BR>分类表删除记录后:

<inquire:QueryTag dataBaseName="mobileshop"

                                tableName="mobileClassify"

                              user="root" password="" />

   <BR><%=queryResult%>

</FONT></BODY></HTML>

DelClassifyRecord.tag

<%@tag pageEncoding="GB2312"%>

<%@tag import="java.sql.*"%>

<%@attribute name="id" required="true"%>

<%String condition=

"DELETE FROM mobileClassify WHERE id= '"+id+"'";

try{ Class.forName("com.mysql.jdbc.Driver");

}

catch(Exception e){}

Connection con;

Statement sql;

ResultSet rs;

try{ String uri="jdbc:mysql://localhost/mobileshop?"+

"user=root&password=&characterEncoding=GB2312";

con=DriverManager.getConnection(uri);

con=DriverManager.getConnection(uri,"root","");

sql=con.createStatement();

sql.executeUpdate(condition);

con.close();

}

catch(Exception e){

out.print(""+e);

}

%>

 

订单管理

添加订单

orderAdd.jsp

<%@page contentType="text/html;charset=gb2312"%>

<%@taglib tagdir="/WEB-INF/tags" prefix="inquire"%>

<HTML><BODY bgcolor=pink><FONT size=6>

<FORM action="newOrder.jsp" method=post>

添加新纪录:

<table border=1>

<tr><td>序号:<Input type="text" name="id"></tr>

<tr><td>消费者用户名:<Input type="text" name="logname"></td></tr>

<tr><td>消费事项:<Input type="text" name="mess"></td></tr>

<tr><td>消费总额:<Input type="text" name="sum"></td></tr>

</table>

<BR><input type="submit" name="b" value="提交">

<BR>orderform表添加新纪录之前的记录是:

<inquire:QueryTag dataBaseName="mobileshop"

                                tableName="orderform"

                              user="root" password="" />

   <BR><%=queryResult%>

</FONT></BODY></HTML>

newOrder.jsp

<%@page contentType="text/html;charset=gb2312"%>

<%@taglib tagdir="/WEB-INF/tags" prefix="inquire"%>

<HTML><BODY bgcolor=pink><FONT size=2>

<%!

String handleStr(String s){

try{

byte bb[]=s.getBytes("iso-8859-1");

return new String(bb);

}

catch(Exception exp){}

return s;

}

%>

<% String id=handleStr(request.getParameter("id"));

String log=handleStr(request.getParameter("logname"));

String mes=handleStr(request.getParameter("mess"));

String su=handleStr(request.getParameter("sum"));

%>

<inquire:AddOrderRecord id="<%=id%>" logname="<%=log%>"

                                  mess="<%=mes%>"  sum="<%=su%>" />

<BR>orderform表添加新记录后的记录是:

<inquire:QueryTag dataBaseName="mobileshop"

                                tableName="orderform"

                              user="root" password="" />

   <BR><%=queryResult%>

<BR><td><A href="index.jsp"><font size=2>返回主页</font></A></td>

</FONT></BODY></HTML>

AddOrderRecord.tag

<%@tag pageEncoding="GB2312"%>

<%@tag import="java.sql.*"%>

<%@attribute name="id" required="true"%>

<%@attribute name="logname" required="true"%>

<%@attribute name="mess" required="true"%>

<%@attribute name="sum" required="true"%>

<%

  String condition="INSERT INTO orderform VALUES"+

          "("+"'"+id+"','"+logname+"','"+mess+"','"+sum+"')";

try{ Class.forName("com.mysql.jdbc.Driver");

        }

catch(Exception e){}

Connection con;

Statement sql;

ResultSet rs;

try{

       String uri="jdbc:mysql://127.0.0.1/mobileshop?"+

       "user=root&password=&characterEncoding=gb2312";

      con=DriverManager.getConnection(uri);

     sql=con.createStatement();

     sql.executeUpdate(condition);

     con.close();

 }

catch(Exception e){

   out.print(""+e);

}

%>

 

删除订单

orderDelete.jsp

<%@page contentType="text/html;charset=GB2312"%>

<%@taglib tagdir="/WEB-INF/tags" prefix="inquire"%>

<HTML><BODY bgcolor=pink><FONT size=3>

<FORM action="deleteOrder.jsp" method=post>

删除记录:<BR>输入您希望删除的订单的消费者名称:

<INPUT type="text" name="name" size=10>

<BR><Input type="submit" name="b" value="提交">

<BR>被删除前的订单表:

<inquire:QueryTag dataBaseName="mobileshop"

                               tableName="orderform"

                             user="root" password="" />

<BR><%=queryResult%>

</FONT></BODY></HTML>

deleteOrder.jsp

<%@page contentType="text/html;charset=gb2312"%>

<%@taglib tagdir="/WEB-INF/tags" prefix="inquire"%>

<HTML><BODY><FONT size=3>

<% String na=request.getParameter("name");

       if(na==null)

        na="";

      byte []bb=na.getBytes("iso-8859-1");

       na=new String(bb);

%>

<inquire:DelOrderRecord name="<%=na%>" />

<BR>orderform表删除记录后:

<inquire:QueryTag dataBaseName="mobileshop"

                                tableName="orderform"

                              user="root" password="" />

   <BR><%=queryResult%>

</FONT></BODY></HTML>

DelOrderRecord.tag

<%@tag pageEncoding="GB2312"%>

<%@tag import="java.sql.*"%>

<%@attribute name="name" required="true"%>

<%String condition=

"DELETE FROM orderform WHERE logname= '"+name+"'";

try{ Class.forName("com.mysql.jdbc.Driver");

}

catch(Exception e){}

Connection con;

Statement sql;

ResultSet rs;

try{ String uri="jdbc:mysql://localhost/mobileshop?"+

"user=root&password=&characterEncoding=GB2312";

con=DriverManager.getConnection(uri);

con=DriverManager.getConnection(uri,"root","");

sql=con.createStatement();

sql.executeUpdate(condition);

con.close();

}

catch(Exception e){

out.print(""+e);

}

%>