您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 信息化管理 > JEECMS2源码的解读
JeeCMS2源码阅读安装..................................................................................................................................................1jcaptcha自定义验证码...................................................................................................................7Xml...................................................................................................................................................7Spring事务.......................................................................................................................................8Struts2与Spring之间URL跳转..................................................................................................11后台登陆.........................................................................................................................................12jcaptcha自定义验证码例子.........................................................................................................15HibernateInterceptor......................................................................................................................16Springjdbc......................................................................................................................................16进入前台.........................................................................................................................................18标签解读.........................................................................................................................................21freemarker+struts2应用.................................................................................................................23安装metahttp-equiv=refreshcontent=3;URL=install/index.html/您还没有安装JEECMS,3秒钟之后自动跳转到安装页面。br/如果您的浏览器长时间没有反应,请直接点击ahref=install/index.htmlJEECMS安装/a。install/index.html:一般是同意安装页scripttype=text/javascriptfunctionformSubmit(){if(document.getElementById('license_agree').checked==false){alert('请同意我们的协议');returnfalse;}document.getElementById('license_form').submit();}/scriptformid=license_formaction=install_params.jspmethod=postinputtype=buttonclass=btnonclick=formSubmit();value=下一步/进入安装数据库和参数页:formaction=install_setup.jspmethod=postonsubmit=returnformSubmit();trtdheight=30align=right域名:/tdtdalign=leftinputname=domaintype=textclass=inputvalue=%=request.getServerName()%//tdtdalign=left系统已经检测出您的域名,请勿改动/td/trtrtdheight=30align=right部署路径:/tdtdalign=leftinputname=cxtPathtype=textclass=inputvalue=%=request.getContextPath()%//tdtdalign=left系统已经检测出您的部署路径,请勿改动/td/tr安装:%@pagecontentType=text/html;charset=gbklanguage=javaimport=com.jeecms.core.util.*,java.util.*%%StringdbFileName=/install/db/jeecms-db-2.4.2-final.sql;StringinitFileName=/install/db/jeecms-init-2.4.2-final.sql;//创建数据库if(true.equals(isCreateDb)){Install.createDb(dbHost,dbPort,dbName,dbUser,dbPassword);}else{Install.changeDbCharset(dbHost,dbPort,dbName,dbUser,dbPassword);}//创建表if(true.equals(isCreateTable)){StringsqlPath=application.getRealPath(dbFileName);ListStringsqlList=Install.readSql(sqlPath);Install.createTable(dbHost,dbPort,dbName,dbUser,dbPassword,sqlList);}//初始化数据if(true.equals(isInitData)){StringinitPath=application.getRealPath(initFileName);ListStringinitList=Install.readSql(initPath);Install.createTable(dbHost,dbPort,dbName,dbUser,dbPassword,initList);}//更新配置Install.updateConfig(dbHost,dbPort,dbName,dbUser,dbPassword,domain,cxtPath,port);//处理数据库配置文件StringdbXmlPath=application.getRealPath(dbXmlFileName);Install.dbXml(dbXmlPath,dbHost,dbPort,dbName,dbUser,dbPassword);//处理web.xmlStringwebXmlFromPath=application.getRealPath(webXmlFrom);StringwebXmlToPath=application.getRealPath(webXmlTo);Install.webXml(webXmlFromPath,webXmlToPath);//在Util里面/***安装类**@authorliufang**/publicclassInstall{publicstaticvoiddbXml(StringfileName,StringdbHost,StringdbPort,StringdbName,StringdbUser,StringdbPassword)throwsException{Strings=FileUtils.readFileToString(newFile(fileName));s=s.replaceFirst(DB_HOST,dbHost);s=s.replaceFirst(DB_PORT,dbPort);s=s.replaceFirst(DB_NAME,dbName);s=s.replaceFirst(DB_USER,dbUser);s=s.replaceFirst(DB_PASSWORD,dbPassword);FileUtils.writeStringToFile(newFile(fileName),s);}publicstaticConnectiongetConn(StringdbHost,StringdbPort,StringdbName,StringdbUser,StringdbPassword)throwsException{Class.forName(com.mysql.jdbc.Driver).newInstance();StringconnStr=jdbc:mysql://+dbHost+:+dbPort+/+dbName+?user=+dbUser+&password=+dbPassword+&characterEncoding=GBK;Connectionconn=DriverManager.getConnection(connStr);returnconn;}publicstaticvoidwebXml(StringfromFile,StringtoFile)throwsException{FileUtils.copyFile(newFile(fromFile),newFile(toFile));}/***创建数据库**@paramdbHost*@paramdbName*@paramdbPort*@paramdbUser*@paramdbPassword*@throwsException*/publicstaticvoidcreateDb(StringdbHost,StringdbPort,StringdbName,StringdbUser,StringdbPassword)throwsException{Class.forName(com.mysql.jdbc.Driver).newInstance();;StringconnStr=jdbc:mysql://+dbHost+:+dbPort+?user=+dbUser+&pass
本文标题:JEECMS2源码的解读
链接地址:https://www.777doc.com/doc-4404448 .html