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

📄 cmsjspactionelement.java

📁 内容管理
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
     * @param element the element (template selector) to display from the target
     * @throws JspException in case there were problems including the target
     *
     * @see com.opencms.flex.jsp.CmsJspTagInclude
     */    
    public void include(String target, String element) throws JspException {
        this.include(target, element, null);
    }

    /**
     * Include a named sub-element with paramters from the OpenCms VFS, same as
     * using the <code>&lt;cms:include file="..." element="..." /&gt;</code> tag
     * with parameters in the tag body.<p>
     * 
     * The parameter map should be a map where the keys are Strings 
     * (the parameter names) and the values are of type String[].
     * However, as a convenience feature,
     * in case you provide just a String for the parameter value, 
     * it will automatically be translated to a String[1].<p>
     * 
     * The handling of the <code>element</code> parameter depends on the 
     * included file type. Most often it is used as template selector.<p>
     * 
     * <b>Important:</b> Exceptions that occur in the include process are NOT
     * handled even if {@link #setHandleExceptions(boolean)} was set to <code>true</code>.
     * 
     * @param target the target uri of the file in the OpenCms VFS (can be relative or absolute)
     * @param element the element (template selector) to display from the target
     * @param parameterMap a map of the request parameters
     * @throws JspException in case there were problems including the target
     * 
     * @see com.opencms.flex.jsp.CmsJspTagInclude
     */
    public void include(String target, String element, Map parameterMap) throws JspException {
        if (m_notInitialized) return;
        if (parameterMap != null) {
            try {
                HashMap modParameterMap = new HashMap(parameterMap.size());
                // ensure parameters are always of type String[] not just String
                Iterator i = parameterMap.keySet().iterator();
                while (i.hasNext()) {
                    String key = (String)i.next();
                    Object value = parameterMap.get(key);
                    if (value instanceof String[]) {
                        modParameterMap.put(key, value);
                    } else {
                        if (value == null)
                            value = "null";
                        String[] newValue = new String[] { value.toString()};
                        modParameterMap.put(key, newValue);
                    }
                }
                parameterMap = modParameterMap;
            } catch (UnsupportedOperationException e) {
                // parameter map is immutable, just use it "as is"
            }
        }
        CmsJspTagInclude.includeTagAction(m_context, target, element, parameterMap, m_request, m_response);
    }
    
    /**
     * Includes a named sub-element supressing all Exceptions that occur during the include,
     * otherwise the same as using {@link #include(String, String, Map null)}.<p>
     * 
     * This is a convenience method that allows to include elements on a page without checking 
     * if they exist or not. If the target element does not exist, nothing is printed to 
     * the JSP output.<p>
     * 
     * @param target the target uri of the file in the OpenCms VFS (can be relative or absolute)
     * @param element the element (template selector) to display from the target
     */
    public void includeSilent(String target, String element) {
        try {
            include(target, element, null);
        } catch (Throwable t) {
        }
    }  
        
    /**
     * Includes a named sub-element supressing all Exceptions that occur during the include,
     * otherwise the same as using {@link #include(String, String, Map)}.<p>
     * 
     * This is a convenience method that allows to include elements on a page without checking 
     * if they exist or not. If the target element does not exist, nothing is printed to 
     * the JSP output.<p>
     * 
     * @param target the target uri of the file in the OpenCms VFS (can be relative or absolute)
     * @param element the element (template selector) to display from the target
     * @param parameterMap a map of the request parameters
     */
    public void includeSilent(String target, String element, Map parameterMap) {
        try {
            include(target, element, parameterMap);
        } catch (Throwable t) {
        }
    }    
    
    /**
     * Converts a relative URI in the OpenCms VFS to an absolute one based on 
     * the location of the currently processed OpenCms URI.
     * 
     * @param target the relative URI to convert
     * @return the target URI converted to an absolute one
     */
    public String toAbsolute(String target) {
        if (m_notInitialized) return C_NOT_INITIALIZED;
        return m_controller.getCurrentRequest().toAbsolute(target);
    }
            
    /**
     * Calculate a link with the OpenCms link management,
     * same as using the <code>&lt;cms:link&gt;...&lt;/cms:link&gt;</code> tag.<p>
     * 
     * This is important to get the right link for exported resources, 
     * e.g. for images in the online project.
     * 
     * @param link the uri in the OpenCms to link to
     * @return the translated link
     * 
     * @see com.opencms.flex.jsp.CmsJspTagLink
     */
    public String link(String link) {
        if (m_notInitialized) return C_NOT_INITIALIZED;
        try {        
            return CmsJspTagLink.linkTagAction(link, m_request);
        } catch (Throwable t) {
            handleException(t);
        }  
        return "+++ error generating link to '" + link + "' +++";             
    }
    
    /**
     * Returns a selected user property, i.e. information about the currently
     * logged in user, same as using 
     * the <code>&lt;cms:user property="..." /&gt;</code> tag.<p>
     * 
     * @param property the user property to display, please see the tag documentation for valid options
     * @return the value of the selected user property
     * 
     * @see com.opencms.flex.jsp.CmsJspTagUser
     */
    public String user(String property) {
        if (m_notInitialized) return C_NOT_INITIALIZED;
        try {
            return CmsJspTagUser.userTagAction(property, m_request);
        } catch (Throwable t) {
            handleException(t);
        }  
        return "+++ error reading user property '" + property + "' +++";            
    }
    
    /**
     * Returns a selected file property value, same as using 
     * the <code>&lt;cms:property name="..." /&gt;</code> tag or
     * calling {@link #property(String name, String null, String null, boolean false)}.<p>
     * 
     * @param name the name of the property to look for
     * @return the value of the property found, or null if the property could not be found
     * 
     * @see #property(String, String, String, boolean)
     * @see com.opencms.flex.jsp.CmsJspTagProperty
     */
    public String property(String name) {
        return this.property(name, null, null, false);       
    }
        
    /**
     * Returns a selected file property value, same as using 
     * the <code>&lt;cms:property name="..." file="..." /&gt;</code> tag or
     * calling {@link #property(String name, String file, String null, boolean false)}.<p>
     * 
     * @param name the name of the property to look for
     * @param file the file (or folder) to look at for the property
     * @return the value of the property found, or null if the property could not be found
     * 
     * @see #property(String, String, String, boolean)
     * @see com.opencms.flex.jsp.CmsJspTagProperty
     */
    public String property(String name, String file) {
        return this.property(name, file, null, false);       
    }

    /**
     * Returns a selected file property value, same as using
     * the <code>&lt;cms:property name="..." file="..." default="..." /&gt;</code> tag or
     * calling {@link #property(String name, String file, String defaultValue, boolean false)}.<p>
     *
     * @param name the name of the property to look for
     * @param file the file (or folder) to look at for the property
     * @param defaultValue a default value in case the property was not found
     * @return the value of the property found, or the value of defaultValue
     *     if the property could not be found
     *
     * @see #property(String, String, String, boolean)
     * @see com.opencms.flex.jsp.CmsJspTagProperty
     */
    public String property(String name, String file, String defaultValue) {
        return this.property(name, file, defaultValue, false);
    }
            
    /**
     * Returns a selected file property value with optional HTML escaping, same as using 
     * the <code>&lt;cms:property name="..." file="..." default="..." /&gt;</code> tag.<p>
     * 
     * Please see the description of the class {@link com.opencms.flex.jsp.CmsJspTagProperty} for
     * valid options of the <code>file</code> parameter.<p>
     * 
     * @param name the name of the property to look for
     * @param file the file (or folder) to look at for the property
     * @param defaultValue a default value in case the property was not found
     * @param escapeHtml if <code>true</code>, special HTML characters in the return value
     *     are escaped with their number representations (e.g. &amp; becomes &amp;#38;)
     * @return the value of the property found, or the value of defaultValue 
     *     if the property could not be found
     *
     * @see com.opencms.flex.jsp.CmsJspTagProperty
     */
    public String property(String name, String file, String defaultValue, boolean escapeHtml) {
        if (m_notInitialized) return C_NOT_INITIALIZED;
        try {
            if (file == null) file = m_controller.getCmsObject().getRequestContext().getUri();
            return CmsJspTagProperty.propertyTagAction(name, file, defaultValue, escapeHtml, m_request);
        } catch (Throwable t) {
            handleException(t);
        }   
        if (defaultValue == null) {
            return "+++ error reading file property '" + name + "' on '" + file + "' +++";
        } else {
            return defaultValue;
        }
    }

    /**
     * Returns all properites of the current file.<p>
     * 
     * @return Map all properties of the current file
     */
    public Map properties() {
        return this.properties(null);
    }
       
    /**
     * Returns all properites of the selected file.<p>
     * 
     * Please see the description of the class {@link com.opencms.flex.jsp.CmsJspTagProperty} for
     * valid options of the <code>file</code> parameter.<p>
     * 
     * @param file the file (or folder) to look at for the properties
     * @return Map all properties of the current file 
     *     (and optional of the folders containing the file)
     * 
     * @see com.opencms.flex.jsp.CmsJspTagProperty
     */
    public Map properties(String file) {
        if (m_notInitialized) return new HashMap();
        Map value = new HashMap();        

⌨️ 快捷键说明

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