Search in sources :

Example 1 with HtmlContent

use of cn.cerc.jpage.core.HtmlContent in project summer-mis by cn-cerc.

the class AbstractJspPage method getScriptHtml.

// 返回所有的脚本,供jsp中使用 ${jspPage.script}调用
public final HtmlWriter getScriptHtml() {
    HtmlWriter html = new HtmlWriter();
    // 加入脚本文件
    for (String file : getScriptFiles()) {
        html.println("<script src=\"%s?v=%s\"></script>", file, browserCacheVersion);
    }
    // 加入脚本代码
    List<HtmlContent> scriptCode1 = getScriptCodes();
    if (scriptFunctions.size() > 0 || scriptCode1.size() > 0) {
        html.println("<script>");
        // 输出自定义的函数
        for (HtmlContent func : scriptFunctions) {
            func.output(html);
        }
        // 输出立即执行的代码
        if (scriptCode1.size() > 0) {
            html.println("$(function(){");
            for (HtmlContent func : scriptCodes) {
                func.output(html);
            }
            html.println("});");
        }
        html.println("</script>");
    }
    return html;
}
Also used : HtmlContent(cn.cerc.jpage.core.HtmlContent) HtmlWriter(cn.cerc.jpage.core.HtmlWriter)

Example 2 with HtmlContent

use of cn.cerc.jpage.core.HtmlContent in project summer-mis by cn-cerc.

the class UIContent method output.

@Override
public void output(HtmlWriter html) {
    html.println("<section role='content'>");
    super.output(html);
    // 输出追加过来的内容
    for (HtmlContent content : contents) {
        content.output(html);
    }
    html.println("</section>");
}
Also used : HtmlContent(cn.cerc.jpage.core.HtmlContent)

Aggregations

HtmlContent (cn.cerc.jpage.core.HtmlContent)2 HtmlWriter (cn.cerc.jpage.core.HtmlWriter)1