|
|
|
@ -1,16 +1,10 @@
|
|
|
|
|
package ${basePackage}.config;
|
|
|
|
|
|
|
|
|
|
import ${basePackage}.frame.auth.LocalData;
|
|
|
|
|
import ${basePackage}.frame.base.Control;
|
|
|
|
|
import ${basePackage}.frame.utils.UrlUtil;
|
|
|
|
|
import static ${basePackage}.config.ActionConfig.CONTROL_PREFIX;
|
|
|
|
|
import static ${basePackage}.config.ActionConfig.SCREEN_PREFIX;
|
|
|
|
|
import freemarker.template.SimpleScalar;
|
|
|
|
|
import freemarker.template.TemplateMethodModelEx;
|
|
|
|
|
import freemarker.template.TemplateModelException;
|
|
|
|
|
import org.springframework.beans.BeansException;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
|
import org.springframework.validation.support.BindingAwareModelMap;
|
|
|
|
|
import org.springframework.web.context.request.RequestContextHolder;
|
|
|
|
@ -19,6 +13,9 @@ import org.springframework.web.servlet.DispatcherServlet;
|
|
|
|
|
import org.springframework.web.servlet.LocaleResolver;
|
|
|
|
|
import org.springframework.web.servlet.View;
|
|
|
|
|
import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver;
|
|
|
|
|
import ${basePackage}.frame.auth.LocalData;
|
|
|
|
|
import ${basePackage}.frame.base.Control;
|
|
|
|
|
import ${basePackage}.frame.utils.UrlUtil;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
@ -27,21 +24,22 @@ import java.io.File;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Locale;
|
|
|
|
|
|
|
|
|
|
import static xyz.wbsite.config.ActionConfig.CONTROL_PREFIX;
|
|
|
|
|
import static xyz.wbsite.config.ActionConfig.SCREEN_PREFIX;
|
|
|
|
|
|
|
|
|
|
@Configuration
|
|
|
|
|
public class FreeMarkerConfig {
|
|
|
|
|
@Autowired
|
|
|
|
|
private FreeMarkerViewResolver viewResolver;
|
|
|
|
|
@Autowired
|
|
|
|
|
private freemarker.template.Configuration configuration;
|
|
|
|
|
@Value("${r'${server.servlet.context-path}'}")
|
|
|
|
|
private String context;
|
|
|
|
|
|
|
|
|
|
private String suffix = ".ftl";
|
|
|
|
|
|
|
|
|
|
@PostConstruct
|
|
|
|
|
public void setSharedVariable() throws TemplateModelException {
|
|
|
|
|
// 全局共享变量、函数
|
|
|
|
|
configuration.setSharedVariable("context", context);
|
|
|
|
|
configuration.setSharedVariable("context", LocalData.getProp("server.servlet.context-path"));
|
|
|
|
|
configuration.setSharedVariable("screenHolder", new ScreenHolder());
|
|
|
|
|
configuration.setSharedVariable("controlHolder", new ControlHolder());
|
|
|
|
|
configuration.setSharedVariable("UrlUtil", new UrlUtil());
|
|
|
|
|