@Deprecated public class Mixer2XhtmlView extends AbstractMixer2XhtmlView
A method of Controller can return this type. (You need not to use JSP.)
your should add dependency for your application:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.1.2.RELEASE (or higher)</version>
</dependency>
Controller Sample
@Controller
public class FooController {
@Autowired
Mixer2Engine mixer2Engine;
@Autowired
ResourceLoader resourceLoader;
@RequestMapping(value = "/foo")
public Mixer2XhtmlView foo() {
String template = "classpath:HelloWorld.html";
Html html = mixer2Engine.loadHtmlTemplate(
resourceLoader.getResource(template).getInputStream());
html.getById("hellomsg", Div.class).unsetContent();
html.getById("hellomsg", Div.class).getContent().add("Hello Mixer2 !");
return new Mixer2XhtmlView(mixer2Engine, html);
}
@RequestMapping(value = "/bar")
public ModelAndView bar() {
String template = "classpath:HelloWorld.html";
Html html = mixer2Engine.loadHtmlTemplate(
resourceLoader.getResource(template).getInputStream());
html.getById("hellomsg", Div.class).unsetContent();
html.getById("hellomsg", Div.class).getContent().add("Life is beautiful !");
// You can also set Mixer2XhtmlView into normal ModelAndView .
ModelAndView modelAndView = new ModelAndView();
modelAndView.setView(new Mixer2XhtmlView(mixer2Engine, html));
return modelAndView;
}
}
Also, You can implement the original view class
using AbstractMixer2XhtmlView
Constructor and Description |
---|
Mixer2XhtmlView(Mixer2Engine mixer2Engine,
Html html)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
protected Html |
createHtml(Map<String,Object> model,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Deprecated.
|
getContentType, getDocType, getHtml, getLocale, getMixer2Engine, renderMergedOutputModel, setContentType, setDocType, setHtml, setLocale, setMixer2Engine
addStaticAttribute, createMergedOutputModel, createRequestContext, createTemporaryOutputStream, exposeModelAsRequestAttributes, generatesDownloadContent, getAttributesMap, getBeanName, getRequestContextAttribute, getRequestToExpose, getStaticAttributes, isExposePathVariables, prepareResponse, render, setAttributes, setAttributesCSV, setAttributesMap, setBeanName, setExposeContextBeansAsAttributes, setExposedContextBeanNames, setExposePathVariables, setRequestContextAttribute, setResponseContentType, toString, writeToResponse
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
public Mixer2XhtmlView(Mixer2Engine mixer2Engine, Html html)
protected Html createHtml(Map<String,Object> model, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws Exception
createHtml
in class AbstractMixer2XhtmlView
Exception
Copyright © 2021 Project Mixer2. All rights reserved.