com.jfinal.render.ViewType Java Examples

The following examples show how to use com.jfinal.render.ViewType. 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 File: AppConfig.java    From my_curd with Apache License 2.0 6 votes vote down vote up
@Override
public void configConstant(Constants me) {
    if(activeProfile.equalsIgnoreCase("dev")){
        me.setDevMode(true);
    }
    // 使用自扩展的 logback
    me.setLogFactory(new LogBackLogFactory());
    // 开启 jfinal inject 注解
    me.setInjectDependency(true);

    // 上传下载
    me.setBaseUploadPath(configProp.get("file.upload"));
    me.setMaxPostSize(configProp.getInt("file.maxPostSize"));
    me.setBaseDownloadPath(configProp.get("file.download"));

    // 视图
    me.setViewType(ViewType.FREE_MARKER);
    me.setViewExtension(".ftl");
    me.setError403View(Constant.VIEW_PATH + "common/403.ftl");
    me.setError404View(Constant.VIEW_PATH + "common/404.ftl");
    me.setError500View(Constant.VIEW_PATH + "common/500.ftl");

    // jfinal json 和 fast json 混合
    me.setJsonFactory(MixedJsonFactory.me());
    me.setJsonDatePattern("yyyy-MM-dd HH:mm:ss");
}
 
Example #2
Source File: ZrLogConfig.java    From zrlog with Apache License 2.0 6 votes vote down vote up
/**
 * 配置JFinal的常用参数,这里可以看出来JFinal推崇使用代码进行配置的,而不是像Spring这样的通过预定配置方式。代码控制的好处在于高度可控制性,
 * 当然这也导致了很多程序员直接硬编码的问题。
 *
 * @param con
 */
@Override
public void configConstant(Constants con) {
    con.setDevMode(BlogBuildInfoUtil.isDev());
    con.setViewType(ViewType.JSP);
    con.setEncoding("utf-8");
    con.setJsonDatePattern("yyyy-MM-dd");
    con.setI18nDefaultBaseName(com.zrlog.common.Constants.I18N);
    con.setI18nDefaultLocale("zh_CN");
    con.setError404View(com.zrlog.common.Constants.NOT_FOUND_PAGE);
    con.setError500View(com.zrlog.common.Constants.ERROR_PAGE);
    con.setError403View(com.zrlog.common.Constants.FORBIDDEN_PAGE);
    con.setBaseUploadPath(PathKit.getWebRootPath() + com.zrlog.common.Constants.ATTACHED_FOLDER);
    //最大的提交的body的大小
    con.setMaxPostSize(1024 * 1024 * 1024);
}
 
Example #3
Source File: JFinalConfigExt.java    From jfinal-ext3 with Apache License 2.0 5 votes vote down vote up
/**
 * 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) {
	//load properties
	this.loadPropertyFile();
	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());
	JFinalConfigExt.APP_NAME = this.getAppName();
	// config others
	configMoreConstants(me);
}
 
Example #4
Source File: AppConfig.java    From jfinal-api-scaffold with MIT License 5 votes vote down vote up
/**
    * 常量配置
    */
@Override
public void configConstant(Constants me) {
	me.setDevMode(true);//开启开发模式
	me.setEncoding("UTF-8");
       me.setViewType(ViewType.JSP);
}