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

📄 rss.java

📁 tbuy1.1.5是在netbeans环境下用JSF技术编写的一个论坛tbuy1.1.5是在netbeans环境下用JSF技术编写的一个论坛
💻 JAVA
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package biz.tbuy.bbs.bean;import biz.tbuy.bbs.ZoneFactory;import biz.tbuy.bbs.ZoneModel;import java.util.List;import javax.faces.application.Application;import javax.faces.component.UIComponent;import javax.faces.component.UIOutput;import javax.faces.component.UIParameter;import javax.faces.component.UIPanel;import javax.faces.component.html.HtmlPanelGrid;import javax.faces.component.html.HtmlOutputLink;import javax.faces.component.html.HtmlOutputText;/** * * @author Administrator */public class RSS extends BaseBean{    /** RSS param名称标识 */    public final static String RSS = "rss";    /** 用于标识订阅所有专区,如果rss=all表示订阅所有文章 */    public final static String ALL = "all";    /** 所要获取的数量 */    public final static int TOTAL = 30;    /** 对文章主体内容的截取长度(字符数) */    public final static int CONTENT_LENGTH = 300;        private UIPanel _uiPanel;        /** Creates a new instance of RSS */    public RSS() {}        public void setUiPanel(UIPanel uiPanel) {        _uiPanel = uiPanel;    }        public UIPanel getUiPanel() {        _uiPanel = (HtmlPanelGrid)                getApplication().createComponent(HtmlPanelGrid.COMPONENT_TYPE);        List<UIComponent> comList = _uiPanel.getChildren();        comList.add(createLink("讨阅所有专区", ALL));        List<ZoneModel> zones = ZoneFactory.getZones();        if (zones != null && !zones.isEmpty()) {            for (ZoneModel zone : zones) {                comList.add(createLink(zone.getName(), String.valueOf(zone.getNum())));            }        }        return _uiPanel;    }        private UIOutput createLink(String outputDes, String rssValue) {        Application app = getApplication();        HtmlOutputLink link = (HtmlOutputLink)                 app.createComponent(HtmlOutputLink.COMPONENT_TYPE);        HtmlOutputText out = (HtmlOutputText)                 app.createComponent(HtmlOutputText.COMPONENT_TYPE);        UIParameter param = (UIParameter)                 app.createComponent(UIParameter.COMPONENT_TYPE);        //MethodExpression me = app.getExpressionFactory()// el,表达表,返回类型,参数        //        .createMethodExpression(getELContext(), "#{bbs_rss.rss}", null, new Class<?>[0]);        //link.setActionExpression(me);        link.setValue(getComApplication().getHttpContextPath() + "/bbs/rss.faces");        out.setValue("[rss] " + outputDes);        param.setName(RSS);        param.setValue(rssValue);        link.getChildren().add(out);        link.getChildren().add(param);        return link;    }}

⌨️ 快捷键说明

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