1 Star 0 Fork 22

俊帅/WebJava

forked from 老馬/WebJava 
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
ArticleHandler.java 773 Bytes
一键复制 编辑 原始数据 按行查看 历史
Ma 提交于 2015-06-12 09:41 +08:00 . 添加Demo
package Handler;
import Web.*;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
/**
*
* @author Ma
*/
public class ArticleHandler extends Handler {
public void get(String id) {
BaseTemplate index = this.render("article");
Object[] r = DB.find("select * from article where id=?", id);
if (r.length < 1) {
NotFound404.set404("文章不存在");
return;
}
long time = Integer.parseInt((String) r[3]);
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Timestamp now = new Timestamp(time * 1000);
r[3] = df.format(now);
index.assign("article", r);
index.assign("title", r[1].toString());
this.writer(index.display());
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wanjunlovejava/WebJava.git
git@gitee.com:wanjunlovejava/WebJava.git
wanjunlovejava
WebJava
WebJava
master

搜索帮助