介绍

jfinal-ext3,源自jfinal-ext,jfinal-ext2,基于jfinal3.x,扩展了很多特性。

maven

新特性

	void readXls() {

		XlsReadRule xlsReadRule = new XlsReadRule();
		xlsReadRule.setStart(1);
		xlsReadRule.setEnd(6);
		xlsReadRule.setClazz(User.class);

		Column id = Column.create("id");
		Column name = Column.create("name");
		Column addr = Column.create("addr");
		xlsReadRule.alignColumn(id, name, addr);

		String destFileName = "src/test/resources/users.xls";

		List<User> ret = XlsReader.readToModel(User.class, new File(destFileName), xlsReadRule);
		User u = ret.get(0);
		String json = JsonKit.toJson(ret);
		System.out.println(json + "id=" + u.getId() + ";name=" + u.getName() + ";addr=" + u.getAddr());

	}    
    

	void writeXls() {
		
		List<User> users = new ArrayList<User>();
		for (int i = 0; i < 5; i++) {
			User u = new User();
			u.setId(i);
			u.setName("name"+i);
			u.setAddr("addr"+i);
			users.add(u);
		}
		
		 //XlsWriter.data(users).headerRow(1).header("Id","Name", "Addr").column("id","name", "addr").writeToFile("src/test/resources/users.xls");
		 
		 Column id = Column.header("编号", "id");
		 Column name = Column.header("姓名", "name");
		 Column addr = Column.header("地址", "addr");
		 XlsWriter.data(users).columns(id, name, addr).writeToFile("src/test/resources/users.xls");
	}
    
/**
	 * Lazy Config Prop
	 *
	 * <pre>
	 * Properties prop = new Properties();
	 * !// config db
	 * prop.setProperty("db.ds","mysql");
	 * prop.setProperty("db.mysql.active","true");
	 * prop.setProperty("db.mysql.url","localhost/zcq");
	 * prop.setProperty("db.mysql.user","root");
	 * prop.setProperty("db.mysql.password.pkey","MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJbIzkTcjrlDwB3vdc6gKwJ5gAMGRazWOrOeuMCxI2Lb7n/d4DoBySUdM+7HT6Gkfbfz6BM1o/2Gp0PkhkEHAx8CAwEAAQ==");
	 * prop.setProperty("db.mysql.password","TVL59a5MXxM3EB7Ylzf8idFijFX97+ZRxZG+2PpkR4pPCQ5TLtZAok88IGW05CxRvC56ekO++yWhepAEL118lw==");
	 * prop.setProperty("db.mysql.initsize","10");
	 * prop.setProperty("db.mysql.maxactive","100");
	 * prop.setProperty("db.showsql","true");
	 * !// config redis
	 * prop.setProperty("redis.cs","mainCache");
	 * prop.setProperty("redis.mainCache.active","true");
	 * prop.setProperty("redis.mainCache.host","localhost");
	 * prop.setProperty("redis.mainCache.port","6379");
	 * prop.setProperty("redis.mainCache.password","");
	 * prop.setProperty("redis.mainCache.tables","user,hello");
	 * !// config generator
	 * prop.setProperty("ge.dict","true");
	 * prop.setProperty("ge.model.dao","true");
	 * prop.setProperty("ge.mappingkit.classname","TableMappingKit");
	 * prop.setProperty("ge.base.model.outdir","./src/main/java/cn/zhucongqi/api/base/model");
	 * prop.setProperty("ge.base.model.package","cn.zhucongqi.api.base.model");
	 * prop.setProperty("ge.model.outdir","./src/main/java/cn/zhucongqi/api/model");
	 * prop.setProperty("ge.model.package","cn.zhucongqi.api.model");
	 * !// config app
	 * prop.setProperty("app.dev","true");
	 * prop.setProperty("app.post","true");
	 * prop.setProperty("app.name","jf-app");
	 * </pre>
	 */
	public abstract Properties getLazyProp();

使用

<dependency>
    <groupId>com.jfinal</groupId>
    <artifactId>jfinal-ext3</artifactId>
    <version>${new_version}</version>
</dependency>

特性说明

Kits

|-- 
|   |-- META-INF
|   |-- WEB-INF
 		|-- classes  
		|-- errorpages
   		|	|-- 403.jsp
		|	|-- 404.jsp
   	   	|	`-- 500.jsp
       	|-- lib
        `-- pageviews
        	|-- login
        	| 	|-- login.jsp
        		`-- ..jsp
        	|-- admin
        	|	|-- ..
        	|	`-- ..
        	`-- ..
        	
   <pre>
   web.xml:
   	<error-page>
		<error-code>403</error-code>
		<location>/WEB-INF/errorpages/403.jsp</location>
	</error-page>
	<error-page>
		<error-code>404</error-code>
		<location>/WEB-INF/errorpages/404.jsp</location>
	</error-page>
	<error-page>
		<error-code>500</error-code>
		<location>/WEB-INF/errorpages/500.jsp</location>
	</error-page>
   </pre>
配置说明

redis配置详解(redis.mainCache.tables)

Ge的使用