leap学习笔记

1、下载排行

<table width="93%" height="auto" border="0" align="center" cellpadding="0" cellspacing="0">
        <!-- 下载排行 --> <c:forEach items="${topYBDownloadPHlist}" var="ybdownload">
         <tr>
                 <td width="20%" align="center" class="boxborbot" style="height:30px;">
                   <c:if test="${centerflag eq 'Y'}">
     <a title="${ybdownload.title}" href="${root}/portal/search/SearchAction.do?            method=rpcView&resource_id=${ybdownload.resource_id}&s=${spUserId}" target='_blank'>
    </c:if>
        <c:if test="${centerflag ne 'Y'}">
     <a title="${ybdownload.title}" href="${root}/portal/search/SearchAction.do?            method=view&resource_id=${ybdownload.resource_id}&s=${spUserId}" target='_blank'>
    </c:if>
                   ${fn:substring(ybdownload.title,0,3)}
                   <c:if test="${fn:length(ybdownload.title) > 3}">...</c:if>
                   </a>
                  </td>
                  <td width="13%" align="center" class="boxborbot" style="height:30px;">${ybdownload.gradeName}</td>
                  <td width="33%" align="center" class="boxborbot" style="height:30px;">${ybdownload.versionName}</td>
                 <td width="25%" align="center" class="boxborbot" style="height:30px;width:80px;">${ybdownload.type}</td>
                  <td width="9%" align="center" class="boxborbot" style="height:30px;width:100px;">${ybdownload.downloadCount}</td>
               </tr>
 </c:forEach>
</table>

2、上传文件

<tr>
 <td width="16%" height="40">
  上传文件:
 </td>
 <td width="84%" colspan="3">
  <html:file styleClass="file" property="file" size="90" οnchange="changeFile(this)" οnkeydοwn="return false" />
 </td>
</tr>

function changeFile(obj)
{
 if (obj.value!=""){
     var fileName=obj.value.substring(obj.value.lastIndexOf("//")+1,obj.value.length);
     if (fileName.lastIndexOf(".")>-1){
      fileName=fileName.substring(0,fileName.lastIndexOf("."));
     }
     
     if (document.frm.title.value==""){
          document.frm.title.value=fileName;
         }

     if (document.frm.keywords.value==""){
          document.frm.keywords.value=fileName;
         }
 }
}

3、缩略图

<!-- 
 <div id="displaySLT" style="display:none">
  <%
   List list=(List)request.getAttribute("metadataList");
   if(list!=null){
   MtMetadata metadata;
   for(int i=0;i<list.size();i++){
    
    metadata=(MtMetadata)list.get(i);
    ThumbnailMap.loadThumbnailMap();
    String thumbnailFileName=Thumbnail.getThumbnail(session.getServletContext().getRealPath("/thumbnail/"),metadata.getResourcePath(),metadata.getThumbnail());
    String thumbnailView=com.lasun.util.Thumbnail.getThumbInView(session.getServletContext().getRealPath("/thumbnail/"),metadata.getResourcePath(),metadata.getThumbnail(),"140","140",request.getContextPath());
    request.setAttribute("metadata",metadata);
    request.setAttribute("thumbnailFileName",thumbnailFileName);
    request.setAttribute("thumbnailView",thumbnailView);
    if(i%3==0){
  %>
     <div div class="zy-left marTop8 bgcorBlue">
   <%
    }
   %>
     <div class="col">
      <div>
       <c:if test="${metadata.fileName eq null}">
        <c:if test="${centerflag eq 'Y'}"><a href="SearchAction.do?method=rpcView&resource_id=${metadata.id}&s=${spUserId}" target='_blank'></c:if>
           <c:if test="${centerflag ne 'Y'}"><a href="SearchAction.do?method=view&resource_id=${metadata.id}&s=${spUserId}" target='_blank'></c:if>
        <img src="${thumbnailFileName}" border=0 width="100" height="100">
        </img>
        </a>
       </c:if>
       <c:if test="${metadata.fileName ne null}">
        <c:if test="${centerflag eq 'Y'}"><a href="SearchAction.do?method=rpcView&resource_id=${metadata.id}&s=${spUserId}" target='_blank'></c:if>
           <c:if test="${centerflag ne 'Y'}"><a href="SearchAction.do?method=view&resource_id=${metadata.id}&s=${spUserId}" target='_blank'></c:if>
        ${thumbnailView}
        </a>
       </c:if>
       </div>
      <div class="col1">
       <span class="ftB ft14 ftblue">
           <c:if test="${centerflag eq 'Y'}"><a href="SearchAction.do?method=rpcView&resource_id=${metadata.id}&s=${spUserId}" target='_blank'></c:if>
           <c:if test="${centerflag ne 'Y'}"><a href="SearchAction.do?method=view&resource_id=${metadata.id}&s=${spUserId}" target='_blank'></c:if>
           <!-- 
           ${fn:substring(metadata.title, 0, 10)}<c:if test="${fn:length(metadata.title) > '10'}">...</c:if>
           -->
           <span class="ftblue ftB marL5">[标题]</span>
           ${metadata.title}
           </a>
          </span>
      </div>
     </div>
    <%
     int j=i;
     j=j+1;
     if(j%3==0){
    %>
    </div>
    <%
     }
    %>
  <%
   } 
  }
  %>
 </div>
 --> 
*****************************************************************************************
<script type="text/JavaScript">
 var xmlHttp1;
 function createXMLHttpRequest1()
 {
  if(window.ActiveXObject){
   xmlHttp1 = new ActiveXObject("Microsoft.XMLHTTP");
  }else if(window.XMLHttpRequest){
   xmlHttp1 = new XMLHttpRequest();
  }
 }
 
 function showPicture(){
  theObj = document.getElementById('displayList').style;
   theObj.display = "none";
   
  theObj2 = document.getElementById('displaySLT').style;
   theObj2.display = "block";
 }
 
 function showList(){
  theObj = document.getElementById('displayList').style;
   theObj.display = "block";
     
  theObj2 = document.getElementById('displaySLT').style;
   theObj2.display = "none";
 }
 
 function displayList(){
  createXMLHttpRequest1();
  xmlHttp1.onreadystatechange = handleStateChange1;
  xmlHttp1.open("GET","SearchAction.do?method=changeSession&displayFlag=list",true);
  xmlHttp1.send(null); 
 }
 
 function displaySLT(){
  createXMLHttpRequest1();
  xmlHttp1.onreadystatechange = handleStateChange2;
  xmlHttp1.open("GET","SearchAction.do?method=changeSession&displayFlag=slt",true);
  xmlHttp1.send(null);
  
 }
 
 function handleStateChange1(){
  if(xmlHttp1.readyState == 4){
   if(xmlHttp1.status == 200){
    showList();
   }
  }
 }
 
 function handleStateChange2(){
  if(xmlHttp1.readyState == 4){
   if(xmlHttp1.status == 200){ 
    showPicture();
   }
  }
 }
</script>


<style type="text/css">
.col{
    float:left;
    width:230px;
    margin-left:5px;
    margin-top:10px;
    valign:center;
}

.col1{
 margin-top:5px;
    margin-bottom:5px;
}
</style>

<div id="displaySLT" style="display:none">
 <%
  List list=(List)request.getAttribute("indexDocList");
  for(int i=0;i<list.size();i++){
   IndexDoc doc=(IndexDoc)list.get(i);
   ThumbnailMap.loadThumbnailMap();
   String thumbnailFileName=Thumbnail.getThumbnail(session.getServletContext().getRealPath("/thumbnail/"),doc.getRESOURCE_PATH(),doc.getTHUMBNAIL());
   String thumbnailView=com.lasun.util.Thumbnail.getThumbInView(session.getServletContext().getRealPath("/thumbnail/"),doc.getRESOURCE_PATH(),doc.getTHUMBNAIL(),"140","140",request.getContextPath());
   request.setAttribute("doc",doc);
   request.setAttribute("thumbnailFileName",thumbnailFileName);
   request.setAttribute("thumbnailView",thumbnailView);
   if(i%4==0){
 %>
    <div div class="zy-left marTop8 bgcorBlue">
  <%
   }
  %>
     <div class="col">
      <div>
       <c:if test="${doc.FILE_NAME eq null}">
        <c:if test="${centerflag eq 'Y'}"><a href="SearchAction.do?method=rpcView&resource_id=${doc.RESOURCE_ID}&s=${spUserId}" target='_blank'></c:if>
           <c:if test="${centerflag ne 'Y'}"><a href="SearchAction.do?method=view&resource_id=${doc.RESOURCE_ID}&s=${spUserId}" target='_blank'></c:if>
        <img src="${thumbnailFileName}" border=0 width="100" height="100">
        </img>
        </a>
       </c:if>
       <c:if test="${doc.FILE_NAME ne null}">
        <c:if test="${centerflag eq 'Y'}"><a href="SearchAction.do?method=rpcView&resource_id=${doc.RESOURCE_ID}&s=${spUserId}" target='_blank'></c:if>
           <c:if test="${centerflag ne 'Y'}"><a href="SearchAction.do?method=view&resource_id=${doc.RESOURCE_ID}&s=${spUserId}" target='_blank'></c:if>
        ${thumbnailView}
        </a>
       </c:if>
       </div>
      <div class="col1">
       <span class="ftB ft14 ftblue">
           <c:if test="${centerflag eq 'Y'}"><a href="SearchAction.do?method=rpcView&resource_id=${doc.RESOURCE_ID}&s=${spUserId}" target='_blank'></c:if>
           <c:if test="${centerflag ne 'Y'}"><a href="SearchAction.do?method=view&resource_id=${doc.RESOURCE_ID}&s=${spUserId}" target='_blank'></c:if>
           <!-- 
           ${fn:substring(metadata.title, 0, 10)}<c:if test="${fn:length(metadata.title) > '10'}">...</c:if>
           -->
           <span class="ftblue ftB marL5">[标题]</span>
           ${doc.TITLE}
           </a>
          </span>
      </div>
     </div>
  <%
   int j=i;
   j=j+1;
   if(j%4==0){
  %>
   </div>
 <%
   } 
  }
 %>
</div>

<%
 displayFlag=(String)request.getSession().getAttribute("displayFlag");
 if(displayFlag.equals("list")){
%>
<script type="text/JavaScript">
 showList();
</script>
<%
 }
%>
<%
 displayFlag=(String)request.getSession().getAttribute("displayFlag");
 if(displayFlag.equals("slt")){
%>
<script type="text/JavaScript">
 showPicture();
</script>
<%
 }
%>


*****************************************************************************************************************

 <div id="displaySLT" style="display:none">
  <%
   List list=(List)request.getAttribute("indexDocList");
   for(int i=0;i<list.size();i++){
    IndexDoc doc=(IndexDoc)list.get(i);
    ThumbnailMap.loadThumbnailMap();
    String thumbnailFileName=Thumbnail.getThumbnail(session.getServletContext().getRealPath("/thumbnail/"),doc.getRESOURCE_PATH(),doc.getTHUMBNAIL());
    String thumbnailView=com.lasun.util.Thumbnail.getThumbInView(session.getServletContext().getRealPath("/thumbnail/"),doc.getRESOURCE_PATH(),doc.getTHUMBNAIL(),"140","140",request.getContextPath());
    request.setAttribute("doc",doc);
    request.setAttribute("thumbnailFileName",thumbnailFileName);
    request.setAttribute("thumbnailView",thumbnailView);
    if(i%3==0){
  %>
     <div div class="zy-left marTop8 bgcorBlue">
   <%
    }
   %>
      <div class="col">
       <div>
        <c:if test="${doc.FILE_NAME eq null}">
         <c:if test="${centerflag eq 'Y'}"><a href="SearchAction.do?method=rpcView&resource_id=${doc.RESOURCE_ID}&s=${spUserId}" target='_blank'></c:if>
            <c:if test="${centerflag ne 'Y'}"><a href="SearchAction.do?method=view&resource_id=${doc.RESOURCE_ID}&s=${spUserId}" target='_blank'></c:if>
         <img src="${thumbnailFileName}" border=0 width="100" height="100">
         </img>
         </a>
        </c:if>
        <c:if test="${doc.FILE_NAME ne null}">
         <c:if test="${centerflag eq 'Y'}"><a href="SearchAction.do?method=rpcView&resource_id=${doc.RESOURCE_ID}&s=${spUserId}" target='_blank'></c:if>
            <c:if test="${centerflag ne 'Y'}"><a href="SearchAction.do?method=view&resource_id=${doc.RESOURCE_ID}&s=${spUserId}" target='_blank'></c:if>
         ${thumbnailView}
         </a>
        </c:if>
        </div>
       <div class="col1">
        <span class="ftB ft14 ftblue">
            <c:if test="${centerflag eq 'Y'}"><a href="SearchAction.do?method=rpcView&resource_id=${doc.RESOURCE_ID}&s=${spUserId}" target='_blank'></c:if>
            <c:if test="${centerflag ne 'Y'}"><a href="SearchAction.do?method=view&resource_id=${doc.RESOURCE_ID}&s=${spUserId}" target='_blank'></c:if>
            <!-- 
            ${fn:substring(metadata.title, 0, 10)}<c:if test="${fn:length(metadata.title) > '10'}">...</c:if>
            -->
            <span class="ftblue ftB marL5">[标题]</span>
            ${doc.TITLE}
            </a>
           </span>
       </div>
      </div>
   <%
    int j=i;
    j=j+1;
    if(j%3==0){
   %>
    </div>
  <%
    } 
   }
  %>
 </div>

 

4、上传图片并预览

<tr>
      <td><label>链接图标:</label></td>
         <td>       
         <c:if test="${reLinks.iconPath eq null }">
          <img id="imgsee" src="" width="" height=""/><br>
         </c:if>
         <c:if test="${reLinks.iconPath ne null }">          
          <img id="imgsee" src="${root}/${reLinks.iconPath}" width="160" height="160"/><br>
         </c:if>
         <html:file property="iconName" styleClass="file"  size="27" οnchange="loadimg(this)"/><c:if test="${reLinks.iconPath ne null }">&nbsp;&nbsp;<a href="#" οnclick="deletePhoto()">删除图片</a></c:if><br>
        
         <font align="left" id="uploadPhotoerr" color="red"></font></td>
         </tr>

********************************************************************************
function loadimg(s)
{
 if(s.value!="")
 {
  document.getElementById("uploadPhotoerr").innerHTML="";
  var srcValue = s.value.substr(s.value.lastIndexOf(".")).toLowerCase();
     if(!/(.jpg$)|(.bmp$)|(.png$)|(.gif$)/.test(srcValue)){
     document.getElementById("uploadPhotoerr").innerHTML="图标格式不正确!";
     return;
     }
      var image=new Image();
         image.DYNSRC=s.value;
         if(image.fileSize>2.5*1024*1024){
         document.getElementById("uploadPhotoerr").innerHTML="文件大小不能超过2.5MB!";
       return;
        }
        var imgsee=document.getElementById("imgsee");
     imgsee.style.width=160;
  imgsee.style.height=160;
  imgsee.src=s.value;
  
 }
}

5、返回按钮

<lasun:button value="返回" name="list" img="query" οnclick="javascript:history.go(-1);" />

function goHomePage(){       
 if(!confirm("确实要执行【注销】吗?"))
  return;
 top.location.href="${root}/portal/LoginAction.do?method=logout";
}

_blank,在新窗口显示目标网页
_self,在当前窗口显示目标网页

_parent,框架网页中当前整个窗口位置显示目标网页
_top,框架网页中在上部窗口中显示目标网页

6、对元素为实体的List按照一个字段排序:

方法一:
  ReTeachKnowledge temp = null;
  // 冒泡排序
  for (int i = 0; i < reTeachKnowledges.size() - 1; i++) {

   for (int j = 0; j < reTeachKnowledges.size() - 1 - i; j++) {
    // 从小到大升序排列
    if (reTeachKnowledges.get(j).getSeqNo() > reTeachKnowledges.get(j + 1).getSeqNo()) {
     temp = reTeachKnowledges.get(j);
     reTeachKnowledges.set(j, reTeachKnowledges.get(j + 1));
     reTeachKnowledges.set(j + 1, temp);
    }
   }
  }

方法二: 
  String[] depCode=new String[depList.size()];
  for(int i=0;i<depCode.length;i++){
   depCode[i]=depList.get(i).getDepartmentCode();
  }
  Arrays.sort(depCode);
  
  List<ReDepartment> departmentList = new ArrayList<ReDepartment>();
  for(int j=0;j<depCode.length;j++){
   for(ReDepartment dep:depList){
    if(dep.getDepartmentCode().equals(depCode[j])){
     ReDepartment centerdep=new ReDepartment();
     centerdep.setDepartmentCode(dep.getDepartmentCode());
     centerdep.setDepartmentName(dep.getDepartmentName());
     centerdep.setDepartmentType(dep.getDepartmentType());
     centerdep.setParentCode(dep.getParentCode());
     centerdep.setNodeType(dep.getNodeType());
     departmentList.add(centerdep);
     depList.remove(dep);
     break;
    }
   }
  }


7、取得Manager
MetadataManager mm = (MetadataManager)(ContextUtils.getBean("rcMetadataManager"));

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值