itemManage.jsp
资源名称:wapjsp.rar [点击查看]
上传用户:xiao85513
上传日期:2010-01-11
资源大小:2160k
文件大小:4k
源码类别:
手机WAP编程
开发平台:
Java
- <%@ page import="java.sql.*,java.util.Vector"%>
- <%@ taglib uri="http://herald.seu.edu.cn/yiwen" prefix="cyndi"%>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
- <title>艺文频道管理系统</title>
- <style type="text/css">
- a:{text-decoration:none;color:gray}
- a:link{text-decoration:none;color:gray}
- a:visited{text-decoration:none;color:gray}
- A:hover {text-decoration:none;color:red}
- </style>
- <script language=javascript>
- function check()
- {
- if(document.all.item("classname").value=="")
- {
- alert("please enter the form completely!");
- return false;
- }
- else
- return true;
- }
- </script>
- </head>
- <jsp:useBean id="item" scope="page" class="beanclass.ItemManageBean"/>
- <jsp:setProperty name="item" property="id"/>
- <jsp:setProperty name="item" property="num"/>
- <jsp:setProperty name="item" property="delid"/>
- <%if(item.getNum().equals("1")){%><body onload="document.all.item('classname').focus();"><%}else{%><body><%}%>
- <cyndi:topandbottom title="<%=item.getId()%>">
- <%String temp="";%>
- <table>
- <Tr>
- <%if(item.getNum().equals("1")){%>
- <Td align=left width=400 valign=top>
- <jsp:setProperty name="item" property="*"/>
- <%if(item.getClassname()!=""&&item.getClassname()!=null)
- {
- String str="";
- if(item.getClassid().equals("bigclass"))str="insert into bigclass (classname,flag) values ('"+item.getClassname()+"','"+item.getFlag()+"')";
- else str="insert into smallclass (classname,parentid) values ('"+item.getClassname()+"',"+Integer.parseInt(item.getParentname())+")";%>
- <cyndi:sqlexecute sql="<%=str%>"/>
- <%if(item.getClassid().equals("bigclass")){
- Class.forName("org.gjt.mm.mysql.Driver").newInstance();
- String url ="jdbc:mysql://localhost/javagame?user=nangua&password=2003herald&useUnicode=true&characterEncoding=8859_1";
- Connection con= DriverManager.getConnection(url);
- Statement statement=con.createStatement();
- str="select id from bigclass where classname='"+item.getClassname()+"'";
- ResultSet rs=statement.executeQuery(str);
- if(rs.next())str="create table class"+rs.getString("id")+" (id int(14) not null auto_increment primary key,parentid int(14),title longtext,content longtext,filepath longtext,hot int(14),upfiledate longtext,flag1 longtext,flag2 longtext,flag3 int(14))";
- else str="";
- rs.close();con.close();
- %>
- <cyndi:sqlexecute sql="<%=str%>"/><%}%>
- <%}%>
- <%if(item.getDelclass()!=""&&item.getDelclass()!=null)
- {
- String str="";
- if(item.getDelclass().equals("bigclass"))str="delete from bigclass where id="+item.getDelid();
- else str="delete from smallclass where id="+item.getDelid();%>
- <cyndi:sqlexecute sql="<%=str%>"/>
- <%if(item.getDelclass().equals("bigclass")){str="delete from smallclass where parentid="+item.getDelid();%><cyndi:sqlexecute sql="<%=str%>"/>
- <%str="drop table class"+item.getDelid();%><cyndi:sqlexecute sql="<%=str%>"/><%}%>
- <%}%>
- <BR><BR>
- <table border="0" cellpadding="0" cellspacing="0" width=100%>
- <tr>
- <td align="center">
- <FORM METHOD=POST ACTION="itemManage.jsp?id=<%=item.getId()%>&num=<%=item.getNum()%>" onsubmit="return check();">
- <input type=radio name=classid value="bigclass" checked onclick="document.all.item('belongto').style.display='none';document.all.item('describe').style.display='';">添加手机品牌 <input type=radio name=classid value="smallclass" onclick="document.all.item('belongto').style.display='';document.all.item('describe').style.display='none';">添加手机型号<BR>
- <BR><BR>
- 栏目名称: <input type=text name=classname size="15">
- <span style="display:" id=describe>
- 说明: <input type=text value=" " name=flag size="15">
- </span>
- <span style="display:none" id="belongto">
- 所属栏目:
- <select name="parentname">
- <%Class.forName("org.gjt.mm.mysql.Driver").newInstance();
- String url ="jdbc:mysql://localhost/javagame?user=nangua&password=2003herald&useUnicode=true&characterEncoding=8859_1";
- Connection con= DriverManager.getConnection(url);
- Statement statement=con.createStatement();
- ResultSet rs=statement.executeQuery("select id,classname from bigclass");
- while(rs.next()){
- %>
- <option value=<%=rs.getString("id")%>><%=rs.getString("classname")%></option>
- <%}rs.close();statement.close();con.close();%>
- </select>
- </span>
- <BR><BR>
- <input type=submit value=添加 name="submit">
- </FORM>
- </td>
- </tr>
- </table>
- </td>
- <%temp="itemManage.jsp?id="+item.getId()+"&num=1";%>
- <%}%>
- <TD valign=top>
- <cyndi:itemlook delpage="<%=temp%>"/>
- </td></tr></table>
- </cyndi:topandbottom>
- </body>
- </html>