本文整理汇总了Java中com.jfinal.config.Constants.setViewType方法的典型用法代码示例。如果您正苦于以下问题:Java Constants.setViewType方法的具体用法?Java Constants.setViewType怎么用?Java Constants.setViewType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jfinal.config.Constants
的用法示例。
在下文中一共展示了Constants.setViewType方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configConstant
import com.jfinal.config.Constants; //导入方法依赖的package包/类
/** 配置常量 */
@Override
public void configConstant(Constants me) {
// 加载数据库配置,随后可用getProperty(...)获取值
super.loadPropertyFile("config.properties");
// 配置开发模式
me.setDevMode(super.getPropertyToBoolean("xyweixin.devMode", false));
// 设置视图类型为JSP,默认为FreeMarker
me.setViewType(ViewType.JSP);
// me.setEncoding("UTF-8");
me.setMainRenderFactory(new BeetlRenderFactory());
// 获取GroupTemplate ,可以设置共享变量等操作
// GroupTemplate groupTemplate = BeetlRenderFactory.groupTemplate;
// 配置文件上传的保存基路径
me.setUploadedFileSaveDirectory(super.getProperty("xyweixin.fileUploadDir", "upload"));
// me.setErrorView(401, "/au/login.html");
// me.setErrorView(403, "/au/login.html");
// me.setError404View("/404.html");
// me.setError500View("/500.html");
}
示例2: configConstant
import com.jfinal.config.Constants; //导入方法依赖的package包/类
/**
* 配置常量
*/
@Override
public void configConstant(Constants me) {
druidConfig = loadPropertyFile("config/bruid.properties");
// 加载少量必要配置,随后可用getProperty(...)获取值
me.setDevMode(getPropertyToBoolean("devMode", false));
me.setViewType(ViewType.JSP); // 设置视图类型为Jsp,否则默认为FreeMarker
me.setEncoding("UTF-8");
me.setBaseViewPath("/WEB-INF/pages");
me.setError404View("/404.jsp");
me.setError403View("/500.jsp");
me.setError500View("/500.jsp");
me.setError401View("/500.jsp");
JspRender.setSupportActiveRecord(false);
}
示例3: configConstant
import com.jfinal.config.Constants; //导入方法依赖的package包/类
/**
* Config constant
*
* Default <br/>
* ViewType: JSP <br/>
* Encoding: UTF-8 <br/>
* ErrorPages: <br/>
* 404 : /WEB-INF/errorpages/404.jsp <br/>
* 500 : /WEB-INF/errorpages/500.jsp <br/>
* 403 : /WEB-INF/errorpages/403.jsp <br/>
* UploadedFileSaveDirectory : cfg basedir + appName <br/>
*/
public void configConstant(Constants me) {
me.setViewType(ViewType.JSP);
me.setDevMode(this.getAppDevMode());
me.setEncoding(Const.DEFAULT_ENCODING);
me.setError404View(PageViewKit.get404PageView());
me.setError500View(PageViewKit.get500PageView());
me.setError403View(PageViewKit.get403PageView());
//file upload dir
me.setBaseUploadPath(this.getUploadPath());
//file download dir
me.setBaseDownloadPath(this.getDownloadPath());
JFinalConfigExt.APP_NAME = this.getAppName();
//set file rename policy is random
OreillyCos.setFileRenamePolicy(new RandomFileRenamePolicy());
// config others
configMoreConstants(me);
}
示例4: configConstant
import com.jfinal.config.Constants; //导入方法依赖的package包/类
@Override
public void configConstant(Constants constants) {
// 设置freemarker模板
constants.setViewType(ViewType.FREE_MARKER); //默认的 可以不配置
constants.setBaseViewPath("/WEB-INF/template"); //页面模板根路径
constants.setFreeMarkerViewExtension("ftl"); //freemarker 模板后缀名
// 设置开发模式
loadPropertyFile("jdbc.properties"); // 加载系统属性配置文件,随后可用getProperty(...)获取值
constants.setDevMode(Boolean.valueOf(getProperty("devMode")));
}
示例5: configConstant
import com.jfinal.config.Constants; //导入方法依赖的package包/类
/**
* 配置常量
*/
public void configConstant(Constants me) {
me.setDevMode(isDevMode());
me.setViewType(ViewType.JSP); // 设置视图类型为Jsp,否则默认为FreeMarker
me.setLogFactory(new Log4jLogFactory());
me.setError401View(Config.getStr("PAGES.401"));
me.setError403View(Config.getStr("PAGES.403"));
me.setError404View(Config.getStr("PAGES.404"));
me.setError500View(Config.getStr("PAGES.500"));
}
示例6: configConstant
import com.jfinal.config.Constants; //导入方法依赖的package包/类
public void configConstant(Constants constants) {
PropKit.use("custom/ooo.properties");
constants.setDevMode(true);// 开发模式
// constants.setViewType(ViewType.JSP);
constants.setViewType(ViewType.FREE_MARKER);
constants.setEncoding(AppConsts.ENCODE_CHARSET_UTF8);
}
示例7: configConstant
import com.jfinal.config.Constants; //导入方法依赖的package包/类
public void configConstant(Constants me) {
loadProp("a_little_config_pro.txt", "a_little_config.txt");
me.setDevMode(PropKit.getBoolean("devMode", false));
me.setViewType(ViewType.JSP);
// ApiConfigKit 设为开发模式可以在开发阶段输出请求交互的 xml 与 json 数据
ApiConfigKit.setDevMode(me.getDevMode());
//设置404跳转页面
me.setError404View("/_front/common/404.html");
me.setError500View("/_front/common/500.html");
}
示例8: configConstant
import com.jfinal.config.Constants; //导入方法依赖的package包/类
@Override
public void configConstant(Constants me)
{
this.loadPropertyFile("xfinal.conf", "UTF-8");
me.setViewType(ViewType.FREE_MARKER);
}
示例9: configConstant
import com.jfinal.config.Constants; //导入方法依赖的package包/类
@Override
public void configConstant(Constants constants) {
// set config propertis.
configuration = GojaConfig.getConfigProps();
// dev_mode
final ApplicationMode applicationMode = GojaConfig.getApplicationMode();
final boolean isDev = applicationMode.isDev();
constants.setDevMode(isDev);
// fixed: render view has views//xxx.ftl
final String DEFAULT_VIEW_PATH = PageViewKit.WEBINF_DIR + "views";
viewPath = GojaConfig.getProperty(GojaPropConst.APP_VIEWPATH, DEFAULT_VIEW_PATH);
constants.setBaseViewPath(viewPath);
if (applicationMode.isProd()) {
// 404由于在开发模式下的提示信息,由于404触发的,所以在开发模式不启动404视图界面
constants.setError404View(PageViewKit.get404PageView());
}
constants.setError500View(PageViewKit.get500PageView());
constants.setError403View(PageViewKit.get403PageView());
appName = GojaConfig.getAppName();
// init wxchat config
final String wx_url = GojaConfig.getProperty(GojaPropConst.APP_WXCHAT_URL);
if (!Strings.isNullOrEmpty(wx_url)) {
// Config Wx Api
ApiConfigKit.setDevMode(isDev);
}
if (GojaConfig.isSecurity()) {
final Set<Class<? extends SecurityUserData>> securityUserClass = ClassPathScanning.scan(SecurityUserData.class);
if (CollectionUtils.isNotEmpty(securityUserClass)) {
for (Class<? extends SecurityUserData> securityUserClas : securityUserClass) {
try {
securityUserData = securityUserClas.newInstance();
break;
} catch (InstantiationException | IllegalAccessException e) {
logger.error("the security user data has error!", e);
}
}
}
}
final boolean jspViewType = GojaConfig.getPropertyToBoolean(GojaPropConst.APP_VIEW_JSP, false);
if (jspViewType) {
constants.setViewType(ViewType.JSP);
} else {
constants.setFreeMarkerViewExtension(".ftl");
setFtlSharedVariable();
}
if (isDev) {
constants.setErrorRenderFactory(new GojaErrorRenderFactory());
}
final int uploadMaxFileSize = GojaConfig.getPropertyToInt(GojaPropConst.APP_UPLOAD_MAXFILESIZE, Const.DEFAULT_MAX_POST_SIZE);
constants.setMaxPostSize(uploadMaxFileSize);
final String attachmentPath = GojaConfig.getProperty(GojaPropConst.APP_UPLOAD_PATH, "attachment");
constants.setBaseUploadPath(attachmentPath);
constants.setBaseDownloadPath(attachmentPath);
final String jsonMode = GojaConfig.getJsonMode();
if (!Strings.isNullOrEmpty(jsonMode)) {
if (StringUtils.equalsIgnoreCase("fastjson", jsonMode)) {
constants.setJsonFactory(new FastJsonFactory());
} else if (StringUtils.equalsIgnoreCase("jackson", jsonMode)) {
constants.setJsonFactory(new JacksonFactory());
}
}
final String fileRenamePolicy = GojaConfig.getProperty(GojaPropConst.APP_UPLOAD_FILERENAMEPOLICY, "default");
if (StringUtils.equalsIgnoreCase(fileRenamePolicy, "date")) {
OreillyCos.setFileRenamePolicy(new DateRandomFileRenamePolicy());
} else if (StringUtils.equalsIgnoreCase(fileRenamePolicy, "radom")) {
OreillyCos.setFileRenamePolicy(new RandomFileRenamePolicy());
} else if (StringUtils.equalsIgnoreCase(fileRenamePolicy, "default")) {
OreillyCos.setFileRenamePolicy(new DefaultFileRenamePolicy());
} else {
logger.warn("Upload folder naming of the unknown!");
}
}