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

📄 header.jsp

📁 java 写的一个新闻发布系统
💻 JSP
字号:
<%@ page import="org.jahia.data.*" %><%@ page import="org.jahia.data.fields.*" %><%@ page import="org.jahia.data.files.*" %><%@ page import="org.jahia.data.containers.*" %><%@ page import="org.jahia.gui.*" %><%@ page import="org.jahia.services.pages.*" %><%@ page import="org.jahia.services.usermanager.*" %><%@ page import="org.jahia.exceptions.*" %><%@ page import="java.util.*" %><%@ page contentType="text/html; charset=UTF-8"%><%!        public boolean isPageInPath( JahiaData jData, int destPageID )    throws JahiaException    {        Enumeration thePath = jData.page().getPagePath();        while (thePath.hasMoreElements()) {            JahiaPage aPage = (JahiaPage) thePath.nextElement();            if (aPage.getID() == destPageID) {                return true;            }        }        return false;    }        public boolean isImage( JahiaFileField theFile )    throws JahiaException    {        if (theFile != null) {            String name = theFile.getRealName();            System.out.println( "File RealName is " + name );            if (name != null) {                name = name.toUpperCase();                if ((name.indexOf("JPG") != -1) ||                     (name.indexOf("PNG") != -1) ||                     (name.indexOf("GIF") != -1) ||                     (name.indexOf("JPEG") != -1)) {                        return true;                }            }        }        return false;    }        public String chooseImage( JahiaPage aPage, String theURL )    throws JahiaException    {        if (aPage.getPageType() == 1) { return theURL + "/images/small_link.gif"; }        if (aPage.getPageType() == 2) { return theURL + "/images/small_url.gif"; }        String template = aPage.getPageTemplate().getName();        if (template.indexOf("Address Book") != -1) {            return theURL + "/images/small_adr_book.gif";        } else if (template.indexOf("File") != -1) {            return theURL + "/images/small_file.gif";        } else if (template.indexOf("News") != -1) {            return theURL + "/images/small_news.gif";        } else if (template.indexOf("Text") != -1) {            return theURL + "/images/small_text.gif";        } else if (template.indexOf("Portal") != -1) {            return theURL + "/images/small_portal.gif";        } else if (template.indexOf("Meeting") != -1) {            return theURL + "/images/small_meeting.gif";        } else {            return "";        }    }        public String glueTitle( String in )    {        /*        String out = "";        if (in.length() > 20) {            in = in.substring( 0, 17 ) + "...";        }        for (int i=0; i < in.length(); i++) {            if (in.charAt(i) == ' ') {                out += "&nbsp;";            } else {                out += in.charAt(i);            }        }        */        return GuiBean.glueTitle(in,20);    }    %><%    JahiaData jData = (JahiaData) request.getAttribute( "org.jahia.data.JahiaData" );    if(jData == null) {        HashMap tempEngineMap = (HashMap)   request.getAttribute( "org.jahia.engines.EngineHashMap" );        jData                 = (JahiaData) tempEngineMap.get( "jData" );    }    Calendar theDate = Calendar.getInstance();    String theFormatedDate = theDate.get( Calendar.MONTH ) + 1 + "." + theDate.get( Calendar.DAY_OF_MONTH ) + "." + theDate.get( Calendar.YEAR );    String theURL = jData.gui().drawHttpJspContext(request);    JahiaUser theUser = jData.params().getUser();    int thePageID = jData.page().getID();        // Notes    jData.fields().declareField( "text", "Text", FieldTypes.BIGTEXT, "<jahia_htmleditor>" );        // Jahia Links    jData.containers().declareField( "thelink", "Jahia Link", FieldTypes.PAGE, "" );    Vector jahialinkFields = new Vector();    jahialinkFields.add( "thelink" );    jData.containers().declareContainer( "jahialinks", "Jahia Links", jahialinkFields );        // editMode    boolean editMode = jData.params().getOperationMode().equals(jData.params().EDIT);    // Browser    boolean NS4 = false;    String userAgent = request.getHeader( "user-agent" );    if (userAgent != null) {        if (userAgent.indexOf( "Mozilla/4" ) != -1) {            if (userAgent.indexOf( "MSIE" ) == -1) {                NS4 = true;            }        }    }%>

⌨️ 快捷键说明

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