public class JFinalView
extends org.springframework.web.servlet.view.AbstractTemplateView
关键设置:
1:setContentType("text/html;charset=UTF-8") 设置 content type 字符集为 UTF-8
2:setExposeRequestAttributes(true) 设置将 request 中的属性值注入到 model 中去
便于在模板中使用 #(value) 访问 request.setAttribute(...) 进去的值
3: setExposeSessionAttributes(true) 设置将 session 中的属性值注入到 model 中去
使用在模板中使用 #(value) 访问 session.setAttribute(...) 进去的值
注意:JFinalViewResolver.setSessionInView(true) 中的配置与
JFinalView.setExposeSessionAttributes(true) 可实现
相似的功能,区别在于前者访问方式为 #(session.value) 而后者为
#(value),两种配置只选其一
| 限定符和类型 | 类和说明 |
|---|---|
static class |
JFinalView.InnerSession |
| 构造器和说明 |
|---|
JFinalView() |
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
renderMergedTemplateModel(Map<String,Object> model,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
applyContentType, renderMergedOutputModel, setAllowRequestOverride, setAllowSessionOverride, setExposeRequestAttributes, setExposeSessionAttributes, setExposeSpringMacroHelpersafterPropertiesSet, checkResource, getUrl, isUrlRequired, setUrl, toStringaddStaticAttribute, createMergedOutputModel, createRequestContext, createTemporaryOutputStream, exposeModelAsRequestAttributes, formatViewName, generatesDownloadContent, getAttributesMap, getBeanName, getContentType, getRequestContextAttribute, getRequestToExpose, getStaticAttributes, isExposePathVariables, prepareResponse, render, setAttributes, setAttributesCSV, setAttributesMap, setBeanName, setContentType, setExposeContextBeansAsAttributes, setExposedContextBeanNames, setExposePathVariables, setRequestContextAttribute, setResponseContentType, writeToResponsegetServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContextprotected void renderMergedTemplateModel(Map<String,Object> model, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws Exception
renderMergedTemplateModel 在类中 org.springframework.web.servlet.view.AbstractTemplateViewExceptionCopyright © 2024. All rights reserved.