2017-10-18 11:28

@年轻人 我把阿里的原文也复制过来看吧, 总有一个能看的

2017-10-11 09:07

建议可以看下: package com.jfinal.core; 包下的 Controller类
/**
* Controller
*

* 昨夜西风凋碧树。独上高楼,望尽天涯路。

* 衣带渐宽终不悔,为伊消得人憔悴。

* 众里寻她千百度,蓦然回首,那人却在灯火阑珊处。
*/
/**
* Stores an attribute in this request
* @param name a String specifying the name of the attribute
* @param value the Object to be stored
*/
public Controller setAttr(String name, Object value) {
request.setAttribute(name, value);
return this;
}
是对servlet极薄封装,方便使用记忆

2017-10-09 20:56

记住一点: jfinal模版是与java打通的 , String的API , 可以直接用, 发挥你无限的想象力

2017-10-09 20:54

先看 开发手册吧 , 别着急上手 , 会少走弯路

2017-10-09 11:23

可以先看下源码:
package com.jfinal.core;
中 ActionHandler :
public final void handle(String target, HttpServletRequest request, HttpServletResponse response, boolean[] isHandled) {
if (target.indexOf('.') != -1) {
return ;
}

当你的handler (修改过 target ) 调用
next.handle(target, request, response, isHandled);
时, 最终会调到ActionHandler 的 handle ,
而:
if (target.indexOf('.') != -1) {
return ;
}
jfinal不处理静态资源请求 , (上线 目前基本都使用 nginx处理静态资源, 所以请求也不会到达这里)
而容器(tomcat)是不知道你改了target(URL)的 , 自然没有什么反应了
----------------------
而 转发和重定向 , 容器(tomcat)是知道的你要去哪个URL的, 自然就能到达了

2017-10-09 09:44

@zz210891470
没毛病啊 , 打个断点跟一下吧,

例子:
https://gitee.com/bean80/tpp

2017-10-09 09:23

我是这样用的:
Cache cache = Redis.use(cacheName);
cache.del(cache.keys("*").toArray());

http://www.jfinal.com/share/299

2017-10-09 09:20

万能的Db.update
只要记住一点: jfinal操作数据库是对JDBC极薄封装, 方法名和用法基本和原生相同

2017-09-29 09:16

@Lg 可做的事情太多了, 他们都说波总是怎么能坚持下来的...

2017-09-28 20:45

第二种方式:
public class MyService {

public static MyService me = Duang.duang(MyService.class);

@TxConfig("configName_A")
@Before(Tx.class)
public void operationA() {
// 数据库A 操作 ....
// 操作完后 再操作 其他的 库
me.operationB();
// 再操作 其他的..
}

@TxConfig("configName_B")
@Before(Tx.class)
public void operationB() {
// 数据库B 操作 ....
}

}

2017-09-28 20:17

方式1:
Db.use(configName_A).tx(new IAtom() {
@Override
public boolean run() throws SQLException {
// 数据库A 操作 ....
// 操作完后 再操作 其他的 库
Db.use(configName_B).tx(new IAtom() {
@Override
public boolean run() throws SQLException {
// 数据库B 操作 ....
return true; // 不回滚返回true , 回滚返回 false
}
});
return true; // 不回滚返回true , 回滚返回 false
}
});

2017-09-28 19:28

@apeng520
http://www.jfinal.com/share/236

这个里面有 用API接口 > 新增 数据库连接 的 例子

2017-09-28 18:12

http://www.jfinal.com/download/now?file=jfinal-3.2-manual.pdf

先读手册, 再开发, 会少走弯路, 手册中有讲