当request某个属性值变化之后,它原本所付给的int 变量的值似乎没有跟着改变,必须int变量参与运算,如+1或-1,或者直接用request获取值才能得到想要的结果。否则只能得到最开始所付的值

此页面展示了近期发布的公告列表,包括标题、发布时间、责任者及发布人等信息,并提供了查看详细内容的功能。支持分页浏览、查找及发布公告。

<link rel=stylesheet type=text/css href="/jsptest/css/css.css"> <%@ page contentType="text/html;charset=gbk"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<style type="text/css">
<!--
body {background-color: #F2FAFF;}
A:visited {COLOR: #000000; FONT-SIZE: 12px; TEXT-DECORATION: none }
A:link {COLOR: #000000; FONT-SIZE: 12px; TEXT-DECORATION: none }
A:active {FONT-SIZE: 12px; TEXT-DECORATION: none }
A:hover {COLOR: #ff0000; FONT-SIZE: 12px; TEXT-DECORATION: underline }
-->
</style>
<%
int currentPage=Integer.parseInt(String.valueOf(request.getAttribute("currentPage")));
 int totalRecords=Integer.parseInt(String.valueOf(request.getAttribute("totalRecords")));
 int pageSize=Integer.parseInt(String.valueOf(request.getAttribute("pageSize")));
int totalPage= (int)Math.ceil((double)totalRecords/pageSize); 
%>
<style type="text/css">
<!--
input {solid #999999;}
select {border: 1pt solid #999999;}
.btn{cursor:hand;background-color: #ffffff;border: 1px #555555 solid}
-->
</style>
<html>
<head>
  <title>近期公告列表</title>
<META http-equiv=Content-Type content="text/html;charset=gbk">
</head>
<body bgcolor="#ffffff" text="#000000" style='FONT-SIZE: 12px'>
 
<CENTER >
  <B><font size="3">近期公告列表</font></B>
</CENTER><br>
<html:form action="listBulletinList">
 
 <table border="1" width="100%" cellspacing="0" cellpadding="1"  bgcolor="#ffffff" style='FONT-SIZE: 12px'>
 
   <tr bgcolor="#F2FAFF"  align="center">
   <td  width="12%" height="2"><a href="#">删除(全选)<html:checkbox property="checkAll"  onclick="checkA()" /></a></td>
    <td  width="20%" height="2">公告标题</td>
     <td  width="20%" height="2">发布时间</td>
  <td  width="20%" height="2">责任者</td>
  <td  width="20%" height="2">发布人</td>
     <td  width="20%" height="2">查看</td>
      
   </tr>
    <c:forEach  items="${requestScope.bulletinList}" var="bulletin">
    <tr bgcolor="#ffffff" width="90%" align="center">
    <td><html:multibox property="check_id" >${bulletin['id']}</html:multibox>&nbsp
              
           </td>
          
     <td>&nbsp;<c:out value="${bulletin['title']}" /><c:out value="${watersn['category']}" /></td>
   <td> &nbsp;<c:out value="${bulletin['createtime']}" /></td>
    <td> &nbsp;<c:out value="${bulletin['resperson']}" /><c:out value="${watersn['fileType']}" /></td>
     <td> &nbsp;<c:out value="${bulletin['pubmen']}" /></td>
     <td><a href="#" onclick="javascript:window.open('listBulletinList.do?flag=new&forwards=2&id=<c:out value="${bulletin['id']}" />','公告','top=90,left=170,width=850,height=600')">查看</a></td>  
    </tr>
    
   </c:forEach>
             <tr>
    <td  colspan="9">
    <input type=button value="删除所选" class=button onclick="deleteRows(this.form,0)"/>
    <input type=button value="发布公告" class=button onclick="javascript:window.open('/jsptest/bulletin/new_bulletinnew.jsp?pages= <%=Integer.parseInt(String.valueOf(request.getAttribute("currentPage")))%>','公告','top=10,left=160,width=850,height=700')"/>
    <input type=button value="查找公告" style="display:''" class=button onclick="javascript:window.open('/jsptest/bulletin/lastsearch.jsp','cz','top=120,left=200,width=550,height=400')"/>
    </td>
    </tr>
    <tr bgcolor="#ffffff">
    <td colspan="10">
   
   第 <%=currentPage+1%> 页     共 <%=totalPage%> 页

    <%if(currentPage <totalPage-1){%> <a  

href= "listBulletinList.do?flag=new&forwards=1&pages= <%=currentPage+1%> "> 下一页

</a> <%}%>     <%if(currentPage> 0){%> <a   href= "listBulletinList.do?flag=new&forwards=1&pages= <%=currentPage-1%> ">

上一页 </a> <%}%>
   
   
          
       &nbsp;
       转到第
       <html:text property="pages" value="" onkeydown="return goPage(this)" style='width:45px'/>
       页<input type=button class=button value="确定"   onclick="return goPage1(document.forms[0].pages)"/>
      </td>
     </tr>
 </table>
 <html:hidden property="forwards"/>
 <html:hidden property="flag"/>
</html:form>

</body>
</html>
<script  LANGUAGE="javascript">
<!--
if(<%=request.getAttribute("deleteflag")%>)
{
 
alert("删除成功");
}
//测试是否为整数,且必须大于零(不能为空)
function isIntGzero(FieldName,FieldNote)
{
     isInteger=/^(([-]?[1-9][/d]*)|0)$/;
 
    
      if(!(isInteger.test(FieldName.value) && parseInt(FieldName.value) > 0 ))
         {
           alert(FieldNote+":不能为空且必须是大于零的整数");
     FieldName.value="0";
     FieldName.focus();
     return false;
    }
  
         else
         {
   
   return true;
       }
}

function goPage(pageno)
{
 if (event.keyCode==13)
 {
 
   if(!isIntGzero(pageno,"页数"))
   {
   return false;
   }
  if(pageno.value><%=totalPage%>)
   {
     alert("超出页数范围");
     pageno.focus();
     return false;
   }
   else
   {
 
 document.forms[0].forwards.value=1;
 document.forms[0].pages.value--;
 location="listBulletinList.do?flag=new&forwards=1&pages="+document.forms[0].pages.value;
 //document.forms[0].submit();
 return false;
    }
 }
}
function goPage1(pageno)
{
 
 
   if(!isIntGzero(pageno,"页数"))
   {
   return false;
   }
  if(pageno.value><%=totalPage%>)
   {
     alert("超出页数范围");
     pageno.focus();
     return false;
   }
   else
   {
 
 document.forms[0].forwards.value=1;
 document.forms[0].pages.value--;
 location="listBulletinList.do?flag=new&forwards=1&pages="+document.forms[0].pages.value;
 //document.forms[0].submit();
 return false;
    }
 
}
function deleteRows(theForm,str)
{
    var pd=confirm("真的要删除吗?");
   if(pd!=true)
   {
    return false;
   }
 //获得选择的check列表对象
    var checkIdObj = eval("theForm.check_id");
    //判断对象是否为空
    if (checkIdObj == null) {
        return false;
    }
    //如果check列表对象多于一个
    if(checkIdObj.length){
        for (i=0; i<checkIdObj.length; i++) {
            if(checkIdObj[i].checked){
                theForm.forwards.value=str;
                 theForm.flag.value="new";
                theForm.pages.value='<%=currentPage%>';
                theForm.submit();
                return true;
            }
        }
    }
    //否则
    else{
        if(theForm.check_id.checked){
            theForm.forwards.value=str;
              theForm.flag.value="new";
                 theForm.pages.value='<%=currentPage%>';
            theForm.submit();
            return true;
        }
    }

 return true;
}
//table样式
function TableMouseOver(Obj){
 Obj.style.backgroundColor='#f2f2f2';
}
function TableMouseOut(Obj){
 Obj.style.backgroundColor='';
}


    
   
function checkA(){
 for (var i=0;i<document.forms[0].elements.length;i++){
     var e = document.forms[0].elements[i];
          if(e.name == "check_id")
            {
                 if(document.forms[0].checkAll.checked==true)
                   {
                   e.checked = true;
                   }
                  else if (document.forms[0].checkAll.checked==false)
                  {
                  e.checked=false;
                  }
                  
                  
            }
          
      }
    
   
}
//-->
</script>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值