try {
EntityManagerFactory factory = Persistence.createEntityManagerFactory("j2cmsSSH");//sessionFactory
EntityManager em = factory.createEntityManager();
em.getTransaction().begin();//开始事务
Config config = em.find(Config.class, 1);
em.getTransaction().commit();
if(config.getUuid()==null||"".equals(config.getUuid())||config.getUuid().length()!=36)
{
config.setUuid(java.util.UUID.randomUUID().toString());
}
InetAddress addr = InetAddress.getLocalHost();
String ip=addr.getHostAddress().toString();
config.setIp(ip);
config.setCtp(servletContext.getContextPath());
try {
String logined = "<html><head><title>管理中心-Powered by J2CMS</title><meta http-equiv=Content-Type content=text/html;charset=utf-8></head><frameset rows='85,*' frameborder='NO' border='0' framespacing='0'><frame src='manage/top' noresize='noresize' frameborder='NO' name='topFrame' scrolling='no' marginwidth='0' marginheight='0' target='main' /><frameset cols='250,*' id='frame'><frame src='manage/left' name='leftFrame' noresize='noresize' marginwidth='0' marginheight='0' frameborder='0' scrolling='auto' target='main' /><frame src='manage/right' name='main' marginwidth='0' marginheight='0' frameborder='0' scrolling='auto' target='_self' /></frameset></frameset><noframes><body></body></noframes></html>";
servletContext.setAttribute("logined", logined);
} catch (Exception e) {
System.out.println("操作失败!");