⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clistpaginationcurrentpagescrollingvalue.java

📁 java 写的一个新闻发布系统
💻 JAVA
字号:
package org.jahia.taglibs.pagination;import org.jahia.data.containers.JahiaContainerList;import org.jahia.data.containers.JahiaContainerListPagination;import org.jahia.exceptions.JahiaException;import org.jahia.taglibs.util.Utils;import org.jahia.taglibs.container.ContainerListTag;import org.jahia.utils.JahiaConsole;import java.io.*;import java.util.*;import javax.servlet.*;import javax.servlet.jsp.*;import javax.servlet.jsp.tagext.*;/** * Return the scrolling value of the current page returned from the enclosing ContainerListTag. * * If the attribute valueOnly = "true" ( default value ), returns : * <pre> *		windowSize + "_" + windowOffset, i.e. : '5_10' * <pre> * * Else if valueOnly = "false", generate a hidden input : * <pre> *		<input type="hidden" name="ctnscroll_contentList1" value="5_10"> * *		Where : 'contentList1' is the name of the container list *				'5_10 : the combination of windowSize = 5, windowOffset = 10 regarding to the values of the enclosing container list. * * </pre>  * * @author  NK */public class CListPaginationCurrentPageScrollingValue extends BodyTagSupport {    private JahiaContainerList containerList = null;    private JahiaContainerListPagination cPagination = null;	private String valueOnly = "true";    public void setValueOnly(String value) {        if ( value != null ){        	this.valueOnly = value.trim().toLowerCase();        }    }    public String getValueOnly() {        return this.valueOnly;    }		    public int doStartTag() {        //JahiaConsole.println("CListPaginationCurrentPageScrollingValue: doStartTag", "Started");        // gets the enclosing tag ContainerListTag        ContainerListTag containerListTag = (ContainerListTag) findAncestorWithClass(this, ContainerListTag.class);        if (containerListTag == null || containerListTag.isDeclarationPass()) {        	return SKIP_BODY;        }	        containerList = containerListTag.getContainerList();        if ( containerList == null ){        	return SKIP_BODY;		}          		cPagination = containerList.getCtnListPagination();  		if ( cPagination == null ){        	return SKIP_BODY;		}  					String value = cPagination.getScrollingValue(cPagination.getCurrentPageIndex());		if ( value == null ){        	return SKIP_BODY;		}		if ( this.valueOnly.equals("false") )		{			try {				StringBuffer buff = new StringBuffer("<input type='hidden' name='");				buff.append("ctnscroll_");				buff.append(containerList.getDefinition().getName());				buff.append("' value='");				buff.append(value);				buff.append("'>");				value = buff.toString();						} catch ( Throwable t ) {				t.printStackTrace();				return SKIP_BODY;			}		}			try {            JspWriter out = pageContext.getOut();            out.print(value);		} catch (IOException ioe) {		    JahiaConsole.println("CListPaginationCurrentPageScrollingValue: doStartTag ",ioe.toString());		}        return SKIP_BODY;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -