获取父子栏目内容的知识点总结:更多信息页面的信息内容获取

<%@ page contentType="text/html; charset=utf-8"%>
<%@ page import="com.taiji.waf.util.*"%>
<%@ page import="java.util.*"%>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="com.taiji.waf.common.*"%>
<%@ page import="com.taiji.waf.cms.business.*"%>
<%@ page import="com.taiji.waf.sys.business.*"%>
<%@ page import="com.taiji.waf.portlet.cms.InfoSortPortlet"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<%    
    //从请求中直接获取传过来的栏目信息内容
    ListDataFormBean bean = (ListDataFormBean) request.getAttribute("bean");
    InfoSort defaultSort = (InfoSort) request.getAttribute("defaultSort"); 
    //得到栏目信息的集合
    List infoLinkList = bean.getDataList();
    InfoSort infoSort = (InfoSort) request.getAttribute("sort");
    InfoSortPortlet p = (InfoSortPortlet) request
            .getAttribute("portlet"); //当前portlet
    String ptView = p.getPortletId() + ".ptview"; //当前portlet的调用链接
    //获取层级地址
    String traceInfo = (String) request.getAttribute("traceInfo");
    WafUser user = (WafUser)session.getAttribute("user");
    
    SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd");
    String s = format.format(new Date()); 
    String menuNums = null; 
    if(!infoSort.getInfoSortId().equals("1001")){
        menuNums = (String)session.getAttribute("num");
    }
    int TITLE_MAX_LENGTH = 32;
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>北京西站地区管理委员会</title>
<link rel="stylesheet" type="text/css" href="css/jxwportal2/style.css">
<script language="javascript" type="text/javascript" src="js/jxwportal2/comm_f.js"></script>
<SCRIPT language="javascript">
//控制LeftMenu
function getMenuCount(){
    n=0;
    for(j=0;j<document.all.length;j++){
        if(document.all[j].className=="menu"){
            n++;
        }
    }
    return n;
}
function showsubmenu(sid)
{
  n=getMenuCount();
  for(i=1;i<=n;i++){
   eval("submenu" + i + ".style.display=\"none\";"); 
   eval("menufolder" + i + ".className =\"leftmenuOff\";");
    }
   eval("submenu" + sid + ".style.display=\"block\";");
   eval("menufolder" + sid + ".className =\"leftmenuOn\";");
}
function listInfoLink(id){
    infoLinkForm.funcid.value="showContent";
    infoLinkForm.infoLinkId.value=id;
    infoLinkForm.infoSortId.value="<%=infoSort.getInfoSortId()%>";
    infoLinkForm.action="<%=ptView%>";
    infoLinkForm.target="_blank";
    infoLinkForm.submit();
  }

  function turnPage(start){
    infoLinkForm.start.value=start;
    infoLinkForm.funcid.value="showMore";
    infoLinkForm.infoSortId.value="<%=infoSort.getInfoSortId()%>";
    infoLinkForm.action="<%=ptView%>";
    infoLinkForm.submit();
  }


  function isNumber(str){
    var digits = "0123456789";
    var i = 0;
    var sLength = str.length;
    while ((i < sLength)){
      var c = str.charAt(i);
      if (digits.indexOf(c) == -1) return false;
      i++;
    }
    return true;
  }
  function goPage(start){
    var page = infoLinkForm.page.value;
    var maxpage = <%=bean.getMaxPageCount()%>;
    if(!isNumber(page)){
      alert("页数请输入正整数!");
      infoLinkForm.page.focus();
      return;
    }
    var numpage = new Number(page);
    var nummaxpage = new Number(maxpage);
    if(numpage<=0){
      alert("页数应该大于等于1!");
      infoLinkForm.page.focus();
      return;
    }
    if(numpage > nummaxpage){
      alert("页数超出最大!");
      infoLinkForm.page.focus();
      return;
    }
    if(numpage==1){
      var start = 0;
    }else{
      var start = (numpage-1)*<%=bean.getLength()%>;
    }
    turnPage(start);
  }
  
  function defaultSort(infoid){
         infoLinkForm.action="<%=ptView%>?defaultSortId="+infoid;
            infoLinkForm.submit();
}
</SCRIPT>
</head>

<body>
<form name="infoLinkForm" method="post" action="">
    <input type="hidden" name="funcid" value=""/>
    <input type="hidden" name="start" value="0"/>
    <input type="hidden" name="pageLength" value="15"/>
    <input type="hidden" name="maxpage" value="<%=bean.getMaxPageCount()%>"></input>
    <input type="hidden" name="infoLinkId" value=""/>
    <input type="hidden" name="infoSortId" value=""/>
        
<!--Head-->
<div class="header">

<div class=" mainbody_2j">
<div class=" mainbodyin_2j">
    
    <div class="right_2j">
        <!--map-->
        <div class="map_2j">
            您现在的位置:<%=traceInfo!=null?traceInfo:"" %> <!-- a href="#">首页</a> > <a href="#">一级栏目</a> > <a href="#">二级栏目</a-->
        </div>
        <!--map-->
        <!--Main_2j-->
        <div class="main_2j">
            <div class="title_main_2j">
                <div class="t_l_main_2j"></div>
                <div class="t_r_main_2j">
                    <div class="t_rr_main_2j"></div>
                    <div class="t_rl_main_2j">
                        <h3><%=infoSort. getInfoSortName()%></h3>
                        <div class="clr"></div>
                    </div>
                </div>
                <div class=" clr"></div>
              </div>
            <div class="main_con_2j">
                <ul class="newslist_2j">
                    <%    

                        Iterator iterator = infoLinkList.iterator();
                        if(infoLinkList!= null && infoLinkList.size() > 0) {
                            while(iterator.hasNext()) {
                                InfoLink infoLink = (InfoLink)iterator.next();
                                String title = infoLink.getInfoLinkTitle();
                                if(time.equals(today) || time.equals(yesterday)) {
                                  %>
                                  <li class="data">[<%= time%>]</li>                    
                                  <li class="news">
                                <a href="javascript:listInfoLink('<%=infoLink.getInfoLinkId()%>')" title="<%= title%>">
                                <span class="f_l"><%= DisplayUtil.SubStrDot(title,MAX_INFOLINKTITLE_LENGTH)+infoLinkList.size()%></span><div class="new"></div></a>
                                  </li>
                                  <% 
                                  }else {
                                  %>
                                  <li class="data">[<%= time%>]</li>
                                  <li class="news">
                                <a href="javascript:listInfoLink('<%=infoLink.getInfoLinkId()%>')" title="<%= title%>">
                                <%= DisplayUtil.SubStrDot(title,MAX_INFOLINKTITLE_LENGTH)%></a>
                                  </li>
                                  <%    
                                  }
                            }
                            if(infoLinkList.size() < 15) {
                                for(int i = 0; i < (15 - infoLinkList.size()); i++) {
                                %>
                                <li class="news"></li>
                                <%
                                }
                            }
                        }
                    %>
                </ul>
            <%
               if(infoLinkList != null && infoLinkList.size() > 0) {
               %>
               <div class="pagenav">
               <%
                   if(bean.getFirstStart() == -1) {
               %>
                       第一页 | 
               <%    
                   }else {
               %>
                       <a href="javascript:turnPage('<%=bean.getFirstStart()%>')">第一页</a> | 
               <%     
                   }
               %>
               <%
                if (bean.getPreviousStart() == -1) {
            %>
                    上一页 |
            <%
                } else {
            %>
                    <a href="javascript:turnPage('<%=bean.getPreviousStart()%>')">上一页</a>
            <%
                }
            %>
            <%
                if (bean.getNextStart() == -1) {
            %>
                    下一页 |
            <%
                } else {
            %>
                    <a href="javascript:turnPage('<%=bean.getNextStart()%>')">下一页</a>
            <%
                }
            %>
                  <%
                if (bean.getLastStart() == -1) {
            %>
                    最后页
            <%
                } else {
            %>
                    <a href="javascript:turnPage('<%=bean.getLastStart()%>')">最后页</a>
            <%
                }
            %>
            
            | 第<%=bean.getCurrPage()%>页   共<%=bean.getMaxPageCount()%>页    | 共有 <%=bean.getCount()%><input type="text" name="page"  class="inputTextPage" size="3" value="<%=bean.getCurrPage()%>"/><a href="javascript:goPage()">转到</a>
            </div>
               <%    
               }else {
               %>
                 没有数据!
               <%    
               }
            %>
       
      </div>
      </div>
        <!--Main_2j end-->
    </div>
    <!--Right end-->
    <div class="clr"></div>
</div>
</div>

</div>
<!--Footer end-->
</form>
</body>
</html>


更多信息页面配置在那个栏目下,使用他的时候,相对应的表单action要填写配置了更多页面的portal的id.

posted @ 2012-05-29 13:30  冰镇橘子汽水  阅读(273)  评论(0编辑  收藏  举报