Original Source: http://blog.terac.com/andy/e_329.html
对于普通用户来说,使用传统的桌面应用程序(可能采用不同语言和工具开发的)可能存在这样那样的限制,比如界面风格千变万化、操作习惯不统一、学习难度大、无法或很难和外部应用通信等。而传统的服务器端应用程序或网站也存在许多限制,比如网络连通可能出现问题、响应速度慢、不能保证服务器端始终可用、担心数据安全和个人隐私问题、不够灵活、使用不方便等。
而基于浏览器的桌面应用程序正是综合桌面应用程序和服务器端应用程序的功能产生的。它包含以下优点:
跨平台的、统一的、简单易用的操作界面(基于浏览器,比如IE或FireFox,用户只须要熟悉浏览器,而不必关心是机器运行的Windows、Mac OS X还是Linux,甚至不要OS,只要能运行Browser和JVM的硬件)
Hibernate是最常用最强大的工具。下面是Hibernate Session的封装代码(也可以利用Spring framework来管理): HibernateUtil.java:
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.SessionFactory;
import net.sf.hibernate.Session;
import net.sf.hibernate.cfg.Configuration;
import org.apache.log4j.Logger; public class HibernateUtil {
private static Log log = LogFactory.getLog(HibernateUtil.class);
public static final ThreadLocal threadSession = new ThreadLocal();
private static final SessionFactory sessionFactory;
static {
try {
sessionFactory = new Configuration().configure().buildSessionFactory();
} catch (Throwable ex) {
// We have to catch Throwable, otherwise we will miss
// NoClassDefFoundError and other subclasses of Error
log.error("Building SessionFactory failed.", ex);
throw new ExceptionInInitializerError(ex);
}
}
public static Session currentSession() throws HibernateException {
Session s = (Session) threadSession.get();
if (s == null) {
s = sessionFactory.openSession();
threadSession.set(s);
}
return s;
}
public static void closeSession() throws HibernateException {
Session s = (Session) session.get();
session.set(null);
if (s != null)
s.close();
}
}
Apache Commons Virtual File System - Commons VFS provides a single API for accessing various different file systems. It presents a uniform view of the files from various different sources, such as the files on local disk, on an HTTP server, or inside a Zip archive. 越来越好玩了:)
另外,发现在Windows系统下PHP5也可以在Tomcat下运行(Running php 5.x on windows using tomcat 4.x or 5.x - Simple Thoughts - Java and Web Software)。BBDA with PHP:),不知道PHP的基于文本的数据库都有哪些?我试了一下,phpinfo和一个简单的基于文本的PHP留言本可以使用,phpMyAdmin和几个PHP的blog不能运行,Tomcat直接Crash。 我已经把BBDA框架和以前写的一个非常简单的Struts/Hibernate单用户相册程序打包了,这里下载,下载后解压缩就能用(需要安装好JDK,并设置好path)。login.do是管理界面登陆入口,秘密是:111111。