Java Code Examples for org.springframework.web.servlet.support.JstlUtils

The following examples show how to use org.springframework.web.servlet.support.JstlUtils. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: spring-analysis-note   Source File: TilesView.java    License: MIT License 6 votes vote down vote up
@Override
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request,
		HttpServletResponse response) throws Exception {

	Assert.state(this.renderer != null, "No Renderer set");

	exposeModelAsRequestAttributes(model, request);
	if (this.exposeJstlAttributes) {
		JstlUtils.exposeLocalizationContext(new RequestContext(request, getServletContext()));
	}
	if (this.alwaysInclude) {
		request.setAttribute(AbstractRequest.FORCE_INCLUDE_ATTRIBUTE_NAME, true);
	}

	Request tilesRequest = createTilesRequest(request, response);
	this.renderer.render(getUrl(), tilesRequest);
}
 
Example 2
Source Project: java-technology-stack   Source File: TilesView.java    License: MIT License 6 votes vote down vote up
@Override
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request,
		HttpServletResponse response) throws Exception {

	Assert.state(this.renderer != null, "No Renderer set");

	exposeModelAsRequestAttributes(model, request);
	if (this.exposeJstlAttributes) {
		JstlUtils.exposeLocalizationContext(new RequestContext(request, getServletContext()));
	}
	if (this.alwaysInclude) {
		request.setAttribute(AbstractRequest.FORCE_INCLUDE_ATTRIBUTE_NAME, true);
	}

	Request tilesRequest = createTilesRequest(request, response);
	this.renderer.render(getUrl(), tilesRequest);
}
 
Example 3
Source Project: lams   Source File: TilesView.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void renderMergedOutputModel(
		Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception {

	ServletContext servletContext = getServletContext();
	TilesContainer container = ServletUtil.getContainer(servletContext);
	if (container == null) {
		throw new ServletException("Tiles container is not initialized. " +
				"Have you added a TilesConfigurer to your web application context?");
	}

	exposeModelAsRequestAttributes(model, request);
	JstlUtils.exposeLocalizationContext(new RequestContext(request, servletContext));
	if (this.alwaysInclude) {
		ServletUtil.setForceInclude(request, true);
	}
	container.render(getUrl(), request, response);
}
 
Example 4
Source Project: spring4-understanding   Source File: TilesView.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void renderMergedOutputModel(
		Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception {

	ServletContext servletContext = getServletContext();
	TilesContainer container = ServletUtil.getContainer(servletContext);
	if (container == null) {
		throw new ServletException("Tiles container is not initialized. " +
				"Have you added a TilesConfigurer to your web application context?");
	}

	exposeModelAsRequestAttributes(model, request);
	JstlUtils.exposeLocalizationContext(new RequestContext(request, servletContext));
	if (this.alwaysInclude) {
		ServletUtil.setForceInclude(request, true);
	}
	container.render(getUrl(), request, response);
}
 
Example 5
Source Project: spring-analysis-note   Source File: JstlView.java    License: MIT License 5 votes vote down vote up
/**
 * Wraps the MessageSource with a JSTL-aware MessageSource that is aware
 * of JSTL's {@code javax.servlet.jsp.jstl.fmt.localizationContext}
 * context-param.
 * @see JstlUtils#getJstlAwareMessageSource
 */
@Override
protected void initServletContext(ServletContext servletContext) {
	if (this.messageSource != null) {
		this.messageSource = JstlUtils.getJstlAwareMessageSource(servletContext, this.messageSource);
	}
	super.initServletContext(servletContext);
}
 
Example 6
Source Project: spring-analysis-note   Source File: JstlView.java    License: MIT License 5 votes vote down vote up
/**
 * Exposes a JSTL LocalizationContext for Spring's locale and MessageSource.
 * @see JstlUtils#exposeLocalizationContext
 */
@Override
protected void exposeHelpers(HttpServletRequest request) throws Exception {
	if (this.messageSource != null) {
		JstlUtils.exposeLocalizationContext(request, this.messageSource);
	}
	else {
		JstlUtils.exposeLocalizationContext(new RequestContext(request, getServletContext()));
	}
}
 
Example 7
Source Project: java-technology-stack   Source File: JstlView.java    License: MIT License 5 votes vote down vote up
/**
 * Wraps the MessageSource with a JSTL-aware MessageSource that is aware
 * of JSTL's {@code javax.servlet.jsp.jstl.fmt.localizationContext}
 * context-param.
 * @see JstlUtils#getJstlAwareMessageSource
 */
@Override
protected void initServletContext(ServletContext servletContext) {
	if (this.messageSource != null) {
		this.messageSource = JstlUtils.getJstlAwareMessageSource(servletContext, this.messageSource);
	}
	super.initServletContext(servletContext);
}
 
Example 8
Source Project: java-technology-stack   Source File: JstlView.java    License: MIT License 5 votes vote down vote up
/**
 * Exposes a JSTL LocalizationContext for Spring's locale and MessageSource.
 * @see JstlUtils#exposeLocalizationContext
 */
@Override
protected void exposeHelpers(HttpServletRequest request) throws Exception {
	if (this.messageSource != null) {
		JstlUtils.exposeLocalizationContext(request, this.messageSource);
	}
	else {
		JstlUtils.exposeLocalizationContext(new RequestContext(request, getServletContext()));
	}
}
 
Example 9
Source Project: lams   Source File: TilesView.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request,
		HttpServletResponse response) throws Exception {

	exposeModelAsRequestAttributes(model, request);
	if (this.exposeJstlAttributes) {
		JstlUtils.exposeLocalizationContext(new RequestContext(request, getServletContext()));
	}
	if (this.alwaysInclude) {
		request.setAttribute(AbstractRequest.FORCE_INCLUDE_ATTRIBUTE_NAME, true);
	}

	Request tilesRequest = createTilesRequest(request, response);
	this.renderer.render(getUrl(), tilesRequest);
}
 
Example 10
Source Project: lams   Source File: JstlView.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Wraps the MessageSource with a JSTL-aware MessageSource that is aware
 * of JSTL's {@code javax.servlet.jsp.jstl.fmt.localizationContext}
 * context-param.
 * @see JstlUtils#getJstlAwareMessageSource
 */
@Override
protected void initServletContext(ServletContext servletContext) {
	if (this.messageSource != null) {
		this.messageSource = JstlUtils.getJstlAwareMessageSource(servletContext, this.messageSource);
	}
	super.initServletContext(servletContext);
}
 
Example 11
Source Project: lams   Source File: JstlView.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Exposes a JSTL LocalizationContext for Spring's locale and MessageSource.
 * @see JstlUtils#exposeLocalizationContext
 */
@Override
protected void exposeHelpers(HttpServletRequest request) throws Exception {
	if (this.messageSource != null) {
		JstlUtils.exposeLocalizationContext(request, this.messageSource);
	}
	else {
		JstlUtils.exposeLocalizationContext(new RequestContext(request, getServletContext()));
	}
}
 
Example 12
Source Project: spring4-understanding   Source File: TilesView.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request,
		HttpServletResponse response) throws Exception {

	exposeModelAsRequestAttributes(model, request);
	if (this.exposeJstlAttributes) {
		JstlUtils.exposeLocalizationContext(new RequestContext(request, getServletContext()));
	}
	if (this.alwaysInclude) {
		request.setAttribute(AbstractRequest.FORCE_INCLUDE_ATTRIBUTE_NAME, true);
	}

	Request tilesRequest = createTilesRequest(request, response);
	this.renderer.render(getUrl(), tilesRequest);
}
 
Example 13
Source Project: spring4-understanding   Source File: JstlView.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Wraps the MessageSource with a JSTL-aware MessageSource that is aware
 * of JSTL's {@code javax.servlet.jsp.jstl.fmt.localizationContext}
 * context-param.
 * @see JstlUtils#getJstlAwareMessageSource
 */
@Override
protected void initServletContext(ServletContext servletContext) {
	if (this.messageSource != null) {
		this.messageSource = JstlUtils.getJstlAwareMessageSource(servletContext, this.messageSource);
	}
	super.initServletContext(servletContext);
}
 
Example 14
Source Project: spring4-understanding   Source File: JstlView.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Exposes a JSTL LocalizationContext for Spring's locale and MessageSource.
 * @see JstlUtils#exposeLocalizationContext
 */
@Override
protected void exposeHelpers(HttpServletRequest request) throws Exception {
	if (this.messageSource != null) {
		JstlUtils.exposeLocalizationContext(request, this.messageSource);
	}
	else {
		JstlUtils.exposeLocalizationContext(new RequestContext(request, getServletContext()));
	}
}