简单的 增删改 某类别页面

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
<%@include file="/page/frontend_meta.jsp" %>
<script>
function topage(firstIndex){
var _url = document.URL;
$('#remenberURL').val(_url);
var form = document.form1;
form.firstIndex.value=firstIndex;
form.submit();
}
function addType(){
if($.trim($('#recipeName').val())==''){
alert('类别名称不能为空');
return false;
}
window.location.href='ad/recipe!addType.action?recipeType.name='+$('#recipeName').val();
}
function changeName(id,obj){
if($.trim(obj.value)==''){
alert('类别名称不能为空');
return false;
}
$.ajax({
type:'post',
url:'ad/recipe!editType.action',
data:'id='+id+'&SValue='+obj.value,
dataType:'html',
success:function(msg){
if(msg=='SUCCESS'){
alert('更改成功');
}else{
alert('系统出错');
}
},
error:function(){
alert('系统出错');
}
})
}
</script>
<style>
.addText{height:20px;line-height:20px}
</style>
</head>  
<body>
<form action="ad/recipe!listType.action" method="get" name="form1">
<input type="hidden" name="firstIndex"/>
<input name="remenberURL" type="hidden" value="<s:property value="remenberURL"/>"/>
<table width="99%" border="0" align="center" cellpadding="3" cellspacing="3">
<tr align=right>
<td>当前位置:厨师教路 &gt; 菜谱类别管理</td>
<td width="1%">
<input type="button" class="mulButton" οnclick="descSH(this)" value="打开字段说明"/>
</td>
</tr>
</table>


<div id="fieldDesc">
<table width="99%" border="0" align="center" cellpadding="3" cellspacing="3">
<tr>
<td class="EasySiteTitle">字段说明</td>
</tr>
</table>
<table width="99%" border="0" align="center" cellpadding="3" cellspacing="3">
<tr>
<td class="title">产品类别</td><td class="input">可以直接在输入框里修改,当输入框失去焦点时才会提交数据,类别名称不能为空</td>
<td class="title">添加类别</td><td class="input">在输入框输入后,点击按钮添加类别,名称不能为空</td>
</tr>
</table>
</div>


<table width="99%" border="0" align="center" cellpadding="3" cellspacing="3">
<tr>
<td class="EasySiteTitle">&nbsp;菜谱类别管理</td>
</tr>
</table>


<div style="width:98%;overflow-x:scroll;">
<table id="" class="list" bgcolor="#F7F7F7" width="99%" border="1" bordercolor="#3399FF" cellpadding="3" cellspacing="3">
<tr>
<th class="align_center">序号</th>
<th class="align_center">产品类别</th>
<th class="align_center">操作</th>
</tr>
<s:iterator value="plt.pts" status="s">
<tr>
<td class="align_center"><s:property value="#s.index+1"/></td>
<td class="align_center pd10"><input type="text" οnchange="changeName('<s:property value="id"/>',this)" value="<s:property value="name"/>"/></td>
<td class="align_center pd10"><a href="#" οnclick="if(confirm('确定要删除?')){window.location.href='ad/recipe!deleteType.action?id=<s:property value='id'/>'}return false;">删除</a></td>
</tr>
</s:iterator>
</table>
<table>
<tr>
<td>
<input class="addText" type="text" id="recipeName" /> <input class="mulButton" type ="button" οnclick="javascript:addType();" value="添加类别">
</td>
</tr>
</table>
</div>
<div style="height:20px"></div>
<!-- 分页开始 -->
<div style="margin-right:3%;text-align:right">
<p class="align_right">


<span>共 <s:property value="plt.totalResult"/> 条</span>
<span>共 <s:property value="plt.pageCount"/> 页</span>
<span>当前第 <s:property value="firstIndex"/> 页</span>
 <s:bean
name="org.apache.struts2.util.Counter" id="counter">
<s:param name="first" value="1" />
<s:param name="last" value="plt.pageCount" />
<s:if test="plt.pageCount<5">
<s:iterator>
<input class="mulButton" οnclick="javascript:topage('<s:property/>')" type="button" value="<s:property />"/> 
</s:iterator>
</s:if>
<s:else>
<s:iterator status="curren" id="dangqian">
<s:if
test="
firstIndex==#curren.count or
firstIndex+1==#curren.count or
firstIndex-1==#curren.count or
#curren.count==plt.pageCount or
#curren.count==1
">
<s:if test="firstIndex==#curren.count">

<input class="mulButton" οnclick="javascript:topage('<s:property/>')" type="button" value="<s:property value="#curren.count" />"/>
</s:if>
<s:if test="firstIndex!=#curren.count">
<input class="mulButton" οnclick="javascript:topage('<s:property/>')" type="button" value="<s:property value="#curren.count" />"/>
</s:if>
</s:if>
<s:if test="firstIndex-2==#curren.count and firstIndex-2!=1">
<span>…</span>
</s:if>
<s:if
test="firstIndex+2==#curren.count and firstIndex+2!=plt.pageCount">
<span>…</span>
</s:if>


</s:iterator>
</s:else>
</s:bean>

<input type="text" style="width:60px" id="topageValue" value="" /> <input class="mulButton" type="button" οnclick="javascript:topage($('#topageValue').val())" value="GO!">
</p>
<!-- 分页结束 -->
</div>
</form>
</body>
</html>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值