当前位置: 首页>>代码示例>>Java>>正文


Java Models类代码示例

本文整理汇总了Java中javax.mvc.Models的典型用法代码示例。如果您正苦于以下问题:Java Models类的具体用法?Java Models怎么用?Java Models使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Models类属于javax.mvc包,在下文中一共展示了Models类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processView

import javax.mvc.Models; //导入依赖的package包/类
@Override
public void processView(ViewEngineContext context) throws ViewEngineException {
    Models models = context.getModels();

    try (PrintWriter writer = context.getResponse().getWriter();
        InputStream resourceAsStream = servletContext.getResourceAsStream(resolveView(context));
        InputStreamReader in = new InputStreamReader(resourceAsStream, "UTF-8");
        BufferedReader bufferedReader = new BufferedReader(in);) {

        String viewContent = bufferedReader.lines().collect(Collectors.joining());

        Template template = handlebars.compileInline(viewContent);
        template.apply(models, writer);
    } catch (IOException e) {
        throw new ViewEngineException(e);
    }
}
 
开发者ID:mvc-spec,项目名称:ozark,代码行数:18,代码来源:HandlebarsViewEngine.java

示例2: processView

import javax.mvc.Models; //导入依赖的package包/类
@Override
public void processView(ViewEngineContext context)
        throws ViewEngineException {
    try {
        Models models = context.getModels();
        models.put("request", context.getRequest());
        models.put("locale", context.getRequest().getLocale());
        Writer writer = context.getResponse().getWriter();
        engine.getMustache(context.getView()).render(writer, models);
        writer.flush();
    } catch (IOException e) {
        throw new ViewEngineException(e);
    }
}
 
开发者ID:trimou,项目名称:trimou,代码行数:15,代码来源:TrimouViewEngine.java

示例3: getModels

import javax.mvc.Models; //导入依赖的package包/类
@Override
public Models getModels() {
    return models;
}
 
开发者ID:mvc-spec,项目名称:ozark,代码行数:5,代码来源:ViewEngineContextImpl.java

示例4: MVCWebContext

import javax.mvc.Models; //导入依赖的package包/类
protected MVCWebContext(final HttpServletRequest request, final HttpServletResponse response,
                        final BeanManager beanManager, final ServletContext servletContext, final Models models) {
    super(request, response, beanManager, servletContext);
    this.models = models;
}
 
开发者ID:inbuss,项目名称:thymeleaf-mvc,代码行数:6,代码来源:MVCWebContext.java

示例5: ViewEngineContextImpl

import javax.mvc.Models; //导入依赖的package包/类
/**
 * Constructor for view engine contexts.
 *
 * @param view Name of view.
 * @param models Instance of models.
 * @param request HTTP servlet request.
 * @param response HTTP servlet response.
 * @param uriInfo URI info about the request.
 * @param resourceInfo Resource matched info.
 * @param configuration the configuration.
 */
public ViewEngineContextImpl(String view, Models models, HttpServletRequest request, HttpServletResponse response,
                             UriInfo uriInfo, ResourceInfo resourceInfo, Configuration configuration) {
    this.view = view;
    this.models = models;
    this.request = request;
    this.response = response;
    this.uriInfo = uriInfo;
    this.resourceInfo = resourceInfo;
    this.configuration = configuration;
}
 
开发者ID:mvc-spec,项目名称:ozark,代码行数:22,代码来源:ViewEngineContextImpl.java

示例6: Viewable

import javax.mvc.Models; //导入依赖的package包/类
/**
 * Constructs an instance using a view and a models instance.
 *
 * @param view the view.
 * @param models the models instance.
 */
public Viewable(String view, Models models) {
    this(view, models, null);
}
 
开发者ID:mvc-spec,项目名称:ozark,代码行数:10,代码来源:Viewable.java

示例7: getModels

import javax.mvc.Models; //导入依赖的package包/类
/**
 * Get the models instance.
 *
 * @return the models instance or {@code null}.
 */
public Models getModels() {
    return models;
}
 
开发者ID:mvc-spec,项目名称:ozark,代码行数:9,代码来源:Viewable.java

示例8: setModels

import javax.mvc.Models; //导入依赖的package包/类
/**
 * Set the models instance.
 *
 * @param models the new models instance.
 */
public void setModels(Models models) {
    this.models = models;
}
 
开发者ID:mvc-spec,项目名称:ozark,代码行数:9,代码来源:Viewable.java


注:本文中的javax.mvc.Models类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。