Package jetbrick.template

Examples of jetbrick.template.JetTemplate


        }
        String bodyContent = ctx.getBodyContent();
        ctx.getContext().put("bodyContent", bodyContent);

        file = ctx.getPageContext().getAbsolutionName(file);
        JetTemplate template = ctx.getEngine().getTemplate(file);
        template.render(context, ctx.getWriter());
    }
View Full Code Here


    public static void main(String[] args) {
        Properties config = new Properties();
        //config.put(JetConfig.COMPILE_TOOL, JdtCompiler.class.getName());
        JetEngine engine = JetEngine.create(config);

        JetTemplate template = engine.createTemplate("是否登录");
        StringWriter out = new StringWriter();
        template.render(new HashMap<String, Object>(), out);
        System.out.println(out.toString());
    }
View Full Code Here

    public static void asInclude(JetPageContext ctx, String relativeName, Map<String, Object> parameters) {
        if (relativeName == null || relativeName.length() == 0) {
            throw new IllegalArgumentException("argument relativeName is null or empty.");
        }
        String file = ctx.getAbsolutionName(relativeName);
        JetTemplate template = ctx.getEngine().getTemplate(file);
        JetContext context = new JetContext(ctx.getContext(), parameters);
        JetWriter writer = ctx.getWriter();
        template.render(context, writer);
    }
View Full Code Here

    public static String asIncludeContent(JetPageContext ctx, String relativeName, Map<String, Object> parameters) {
        if (relativeName == null || relativeName.length() == 0) {
            throw new IllegalArgumentException("argument relativeName is null or empty.");
        }
        String file = ctx.getAbsolutionName(relativeName);
        JetTemplate template = ctx.getEngine().getTemplate(file);
        JetContext context = new JetContext(ctx.getContext(), parameters);

        UnsafeCharArrayWriter os = new UnsafeCharArrayWriter();
        template.render(context, os);
        return os.toString();
    }
View Full Code Here

        if (JetWebEngineLoader.unavailable()) {
            JetWebEngineLoader.setServletContext(JFinal.me().getServletContext());
        }

        JetContext context = new JetWebContext(request, response);
        JetTemplate template = JetWebEngineLoader.getJetEngine().getTemplate(view);
        try {
            template.render(context, response.getOutputStream());
        } catch (IOException e) {
            throw ExceptionUtils.uncheck(e);
        }
    }
View Full Code Here

    }

    @Override
    public void render(HttpServletRequest req, HttpServletResponse resp, Object obj) throws Throwable {
        JetContext context = new JetWebContext(req, resp);
        JetTemplate template = JetWebEngineLoader.getJetEngine().getTemplate(evalPath(req, obj));
        try {
            template.render(context, resp.getOutputStream());
        } catch (IOException e) {
            throw Lang.wrapThrow(e);
        }
    }
View Full Code Here

public class JetTemplateView extends AbstractTemplateView {

    @Override
    protected void renderMergedTemplateModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception {
        JetContext context = new JetWebContext(request, response, model);
        JetTemplate template = JetWebEngineLoader.getJetEngine().getTemplate(getUrl());
        template.render(context, response.getOutputStream());
    }
View Full Code Here

        }

        JetContext context = new JetWebContext(request, response, null);
        context.put("action", ai.getAction());
        context.put("valueStack", model);
        JetTemplate template = JetWebEngineLoader.getJetEngine().getTemplate(location);
        template.render(context, response.getOutputStream());
    }
View Full Code Here

TOP

Related Classes of jetbrick.template.JetTemplate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.