文章类别查询

// 查询新闻类别
private void queryType(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
Integer net_id = (Integer) request.getSession().getAttribute("maxId");
TypeDao typeDao = new TypeDao();
request.setAttribute("typlist", typeDao.queryTypeList(net_id));
request.getRequestDispatcher("net_queryType.jsp").forward(request,
response);

}



public List<Type> queryTypeList(Integer net_id) {
List<Type> list = new ArrayList<Type>();
sql = "select * from tb_type where net_id = " + net_id + "";
ResultSet rs = connection.executeQuery(sql);
try {
while (rs.next()) {
Type type = new Type();
type.setId(rs.getInt(1));
type.setType_name(rs.getString(2));
type.setNet_id(rs.getInt(3));
type.setSign(rs.getInt(4));
list.add(type);
}
} catch (SQLException e) {
// TODO 自动生成 catch 块
list = null;
e.printStackTrace();
}
return list;
}


页面
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="css/style.css" type="text/css" rel="stylesheet">
<title>qinya 学习</title>
</head>
<script language="javascript">
function Myopen(divID,id,name){ //根据传递的参数确定显示的层
divID.style.display='block';
divID.style.left=(document.body.clientWidth-240)/2;
divID.style.top=(document.body.clientHeight-139)/2;
form1.ids.value=id;
form1.type_name.value=name;
}
</script>

<body onLoad="clockon(bgclock);">
<jsp:include page="common.jsp" flush="true"></jsp:include>
<jsp:include page="top.jsp" flush="true"></jsp:include>
<jsp:include page="net_Type.jsp" flush="true"></jsp:include>
<table border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="195" align="center" valign="top">
<jsp:include page="left.jsp" flush="true"></jsp:include> </td>
<td align="center" valign="top">

<table width="632" height="48" border="0" align="center" cellpadding="0" cellspacing="0" background="images/3.jpg">
<tr>
<td width="64"> </td>
<td width="568">查询网站信息类别</td>
</tr>
</table>
<table width="435" height="23" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><a href="net_addType.jsp">添加类别</a></td>
</tr>
</table>
<table width="435" height="30" border="1" cellpadding="0" cellspacing="0">
<tr align="center">
<td height="20">编号</td>
<td>名称</td>
<td>操作</td>
</tr>
<c:forEach items="${requestScope.typlist}" var="type">
<tr align="center">
<td height="20">${type.id}</td>
<td>${type.type_name}</td>
<td>

<c:if test="${type.type_name=='公告信息'||type.type_name=='焦点导读'}">
无操作
</c:if>


<c:if test="${type.type_name!='焦点导读'&&type.type_name!='公告信息'}">
<a href="#" onClick="Myopen(type1,'${type.id}','${type.type_name}')">修改</a>   <a href="netInformation?method=deleteType&type_id=${type.id}">删除</a>
</c:if>

</td>
</tr>
</c:forEach>
</table>

<div id="type1" style="position:width:240px; height:139px;display:none;">
<br>
<form name="form1" method="post" action="netInformation?method=updateType">
<table width="305" border="1" cellspacing="0" cellpadding="0">
<tr>
<td height="30">新类别名称:</td>
<td><input type="text" name="type_name"><input name="ids" type="hidden" value=""></td>
</tr>
<tr>
<td height="30"> </td>
<td><input type="submit" name="Submit" value=" 修改 "></td>
</tr>
</table>
</form>
</div> </td>
</tr>
</table>
<jsp:include page="down.jsp" flush="true"></jsp:include>
</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值