<!--java鑿滈笩绗竴绡?->
杩欏嚑澶╁浜嗕笅struts+spring+ibatis+velocity鐨勬鏋剁粍鍚堛€傚紕浜嗕釜Blog鐨勫皬绋嬪簭锛屽熀鏈笂绠楀氨绠€鐨勪簡锛岀暐璁頒箣銆傞珮绾х殑涓滀笢杩樺湪瀛︿範涓€傘€傘€?
1銆亀eb.xml鐨勯厤缃?

<? xml聽version="1.0"聽encoding="UTF-8" ?>

< web-app聽 xmlns ="http://java.sun.com/xml/ns/javaee"

聽聽聽聽xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance" 聽version ="2.5"

聽聽聽聽xsi:schemaLocation ="http://java.sun.com/xml/ns/javaee聽聽聽http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" >

聽聽聽聽 <!-- 聽Spring聽鐨勯厤缃?-->

聽聽聽聽 < context-param >

聽聽聽聽聽聽聽聽 < param-name > context </ param-name >

聽聽聽聽聽聽聽聽 < param-value > /WEB-INF/applicationContext </ param-value >

聽聽聽聽 </ context-param >

聽聽聽聽 < servlet >

聽聽聽聽聽聽聽聽 < servlet-name > context </ servlet-name >

聽聽聽聽聽聽聽聽 < servlet-class >

聽聽聽聽聽聽聽聽聽聽聽聽org.springframework.web.context.ContextLoaderServlet

聽聽聽聽聽聽聽聽 </ servlet-class >

聽聽聽聽聽聽聽聽 < load-on-startup > 1 </ load-on-startup >

聽聽聽聽 </ servlet >

銆€銆€銆€銆€銆€聽 <!-- 聽Struts聽鐨勯厤缃?-->

聽聽聽聽 < servlet >

聽聽聽聽聽聽聽聽 < servlet-name > action </ servlet-name >

聽聽聽聽聽聽聽聽 < servlet-class >

聽聽聽聽聽聽聽聽聽聽聽聽org.apache.struts.action.ActionServlet

聽聽聽聽聽聽聽聽 </ servlet-class >

聽聽聽聽聽聽聽聽 < init-param >

聽聽聽聽聽聽聽聽聽聽聽聽 < param-name > config </ param-name >

聽聽聽聽聽聽聽聽聽聽聽聽 < param-value > /WEB-INF/struts-config.xml </ param-value >

聽聽聽聽聽聽聽聽 </ init-param >

聽聽聽聽聽聽聽聽 < init-param >

聽聽聽聽聽聽聽聽聽聽聽聽 < param-name > debug </ param-name >

聽聽聽聽聽聽聽聽聽聽聽聽 < param-value > 3 </ param-value >

聽聽聽聽聽聽聽聽 </ init-param >

聽聽聽聽聽聽聽聽 < init-param >

聽聽聽聽聽聽聽聽聽聽聽聽 < param-name > detail </ param-name >

聽聽聽聽聽聽聽聽聽聽聽聽 < param-value > 3 </ param-value >

聽聽聽聽聽聽聽聽 </ init-param >

聽聽聽聽聽聽聽聽 < load-on-startup > 0 </ load-on-startup >

聽聽聽聽 </ servlet >

銆€銆€銆€銆€銆€聽 <!-- 聽Velocity聽鐨勯厤缃?-->

聽聽聽聽 < servlet >

聽聽聽聽聽聽聽聽 < servlet-name > velocity </ servlet-name >

聽聽聽聽聽聽聽聽 < servlet-class >

聽聽聽聽聽聽聽聽聽聽聽聽org.apache.velocity.tools.view.servlet.VelocityLayoutServlet

聽聽聽聽聽聽聽聽 </ servlet-class >

聽聽聽聽聽聽聽聽 < init-param >

聽聽聽聽聽聽聽聽聽聽聽聽 < param-name > org.apache.velocity.toolbox </ param-name >

聽聽聽聽聽聽聽聽聽聽聽聽 < param-value > /WEB-INF/toolbox.xml </ param-value >

聽聽聽聽聽聽聽聽 </ init-param >

聽聽聽聽聽聽聽聽 < init-param >

聽聽聽聽聽聽聽聽聽聽聽聽 < param-name > org.apache.velocity.properties </ param-name >

聽聽聽聽聽聽聽聽聽聽聽聽 < param-value > /WEB-INF/velocity.properties </ param-value >

聽聽聽聽聽聽聽聽 </ init-param >

聽聽聽聽聽聽聽聽 < load-on-startup > 2 </ load-on-startup >

聽聽聽聽 </ servlet >

聽聽聽聽 < servlet-mapping >

聽聽聽聽聽聽聽聽 < servlet-name > velocity </ servlet-name >

聽聽聽聽聽聽聽聽 < url-pattern > *.htm </ url-pattern >

聽聽聽聽 </ servlet-mapping >

聽聽聽聽 < servlet-mapping >

聽聽聽聽聽聽聽聽 < servlet-name > action </ servlet-name >

聽聽聽聽聽聽聽聽 < url-pattern > *.do </ url-pattern >

聽聽聽聽 </ servlet-mapping >

聽聽聽聽 < welcome-file-list >

聽聽聽聽聽聽聽聽 < welcome-file > pages/index.jsp </ welcome-file >

聽聽聽聽 </ welcome-file-list >

</ web-app >

2銆乤pplicationContext.xml鐨勯厤缃?

<? xml聽version="1.0"聽encoding="UTF-8" ?>

< beans聽 xmlns ="http://www.springframework.org/schema/beans"

聽聽聽聽xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance"

聽聽聽聽xsi:schemaLocation ="http://www.springframework.org/schema/beans聽http://www.springframework.org/schema/beans/spring-beans-2.0.xsd" >

銆€銆€銆€銆€ <!-- 鏁版嵁搴撻厤缃?-->

聽聽聽聽 < bean聽 id ="dataSource"

聽聽聽聽聽聽聽聽class ="org.springframework.jdbc.datasource.DriverManagerDataSource" >

聽聽聽聽聽聽聽聽 < property聽 name ="driverClassName" >

聽聽聽聽聽聽聽聽聽聽聽聽 < value > ${JDBC.Driver} </ value >

聽聽聽聽聽聽聽聽 </ property >

聽聽聽聽聽聽聽聽 < property聽 name ="url" >

聽聽聽聽聽聽聽聽聽聽聽聽 < value > ${JDBC.ConnectionURL} </ value >

聽聽聽聽聽聽聽聽 </ property >

聽聽聽聽聽聽聽聽 < property聽 name ="username" >

聽聽聽聽聽聽聽聽聽聽聽聽 < value > ${Username} </ value >

聽聽聽聽聽聽聽聽 </ property >

聽聽聽聽聽聽聽聽 < property聽 name ="password" >

聽聽聽聽聽聽聽聽聽聽聽聽 < value > ${Password} </ value >

聽聽聽聽聽聽聽聽 </ property >

聽聽聽聽 </ bean >

銆€銆€銆€ <!-- 涓巌batis鏁村悎 -->

聽聽聽聽 < bean聽 id ="sqlMapClient"

聽聽聽聽聽聽聽聽class ="org.springframework.orm.ibatis.SqlMapClientFactoryBean" >

聽聽聽聽聽聽聽聽 < property聽 name ="configLocation" >

聽聽聽聽聽聽聽聽聽聽聽聽 < value > WEB-INF/sql-map-config.xml </ value >

聽聽聽聽聽聽聽聽 </ property >

聽聽聽聽聽聽聽聽 < property聽 name ="dataSource" >

聽聽聽聽聽聽聽聽聽聽聽聽 < ref聽 bean ="dataSource" 聽 />

聽聽聽聽聽聽聽聽 </ property >

聽聽聽聽 </ bean >

聽聽聽聽 < bean聽 id ="TransactionManager"

聽聽聽聽聽聽聽聽class ="org.springframework.jdbc.datasource.DataSourceTransactionManager" >

聽聽聽聽聽聽聽聽 < property聽 name ="dataSource" >

聽聽聽聽聽聽聽聽聽聽聽聽 < ref聽 bean ="dataSource" 聽 />

聽聽聽聽聽聽聽聽 </ property >

聽聽聽聽 </ bean >

銆€銆€銆€銆€銆€ <!-- 鐢ㄦ埛DAO閰嶇疆 -->

聽聽聽聽 < bean聽 id ="blogDAO"

聽聽聽聽聽聽聽聽class ="com.renyao.ryblog.DAO.DefaultBlogDAO" >

聽聽聽聽聽聽聽聽 < property聽 name ="sqlMapClient" >

聽聽聽聽聽聽聽聽聽聽聽聽 < ref聽 local ="sqlMapClient" 聽 />

聽聽聽聽聽聽聽聽 </ property >

聽聽聽聽 </ bean >

</ beans >
3銆乻ql-map-config.xml鐨勯厤缃?

<? xml聽version="1.0"聽encoding="UTF-8" ?>

<! DOCTYPE聽sqlMapConfig聽PUBLIC聽"-//iBATIS.com//DTD聽SQL聽Map聽Config聽2.0//EN"聽"http://www.ibatis.com/dtd/sql-map-config-2.dtd" >

< sqlMapConfig >

聽聽聽聽 < settings聽 cacheModelsEnabled ="true" 聽enhancementEnabled ="true"

聽聽聽聽聽聽聽聽lazyLoadingEnabled ="true" 聽maxRequests ="32" 聽maxSessions ="10"

聽聽聽聽聽聽聽聽maxTransactions ="5" 聽useStatementNamespaces ="false" 聽 />

聽聽聽聽聽聽聽聽聽聽聽聽聽聽 <!-- 鏄犲皠瀛樻斁sql璇彞鐨剎ml鏂囦歡璧勬簮 -->

聽聽聽聽 < sqlMap聽 resource ="com/renyao/ryblog/Blog.xml" 聽 />

</ sqlMapConfig >
4銆乮batis鏄犲皠鏂囦歡瀹炰緥--Blog.xml

<? xml聽version="1.0"聽encoding="UTF-8" ?>

<! DOCTYPE聽sqlMap

PUBLIC聽"-//iBATIS.com//DTD聽SQL聽Map聽2.0//EN"

"http://www.ibatis.com/dtd/sql-map-2.dtd" >

< sqlMap聽 namespace ="Blog" >

銆€銆€銆€銆€ <!-- select,update,insert,delete.聽id鍚嶇敤浜庤闂璧勬簮锛宺esultClass琛ㄧず杈撳嚭绫誨瀷锛宲arameterClass琛ㄧず杈撳叆鍙傛暟 -->

聽聽聽聽 < select聽 id ="getBlog" 聽resultClass ="com.renyao.ryblog.bean.Blog" >

聽聽聽聽聽聽聽聽SELECT聽BID聽as聽bid聽,聽TITLE聽as聽title,聽CONTENT聽as聽content,

聽聽聽聽聽聽聽聽CREATETIME聽as聽createTime,聽MODIFYTIME聽as聽modifyTime,聽CREATER聽as

聽聽聽聽聽聽聽聽creator,STATUS聽as聽status聽,ISOPEN聽as聽isOpen聽,PICURL聽as聽picURL

聽聽聽聽聽聽聽聽FROM聽BLOG聽WHERE聽BID聽=聽#value#

聽聽聽聽 </ select >

聽聽聽聽 < select聽 id ="getBlogByTitle"

聽聽聽聽聽聽聽聽resultClass ="com.renyao.ryblog.bean.Blog" >

聽聽聽聽聽聽聽聽SELECT聽BID聽as聽bid聽,聽TITLE聽as聽title,聽CONTENT聽as聽content,

聽聽聽聽聽聽聽聽CREATETIME聽as聽createTime,聽MODIFYTIME聽as聽modifyTime,聽CREATER聽as

聽聽聽聽聽聽聽聽creator,STATUS聽as聽status聽,ISOPEN聽as聽isOpen聽,PICURL聽as聽picURL

聽聽聽聽聽聽聽聽FROM聽BLOG聽WHERE聽TITLE聽like聽#value#

聽聽聽聽 </ select >

聽聽聽聽 < select聽 id ="getAllBlog" 聽resultClass ="com.renyao.ryblog.bean.Blog" >

聽聽聽聽聽聽聽聽SELECT聽BID聽as聽bid聽,聽TITLE聽as聽title,聽CONTENT聽as聽content,

聽聽聽聽聽聽聽聽CREATETIME聽as聽createTime,聽MODIFYTIME聽as聽modifyTime,聽CREATER聽as

聽聽聽聽聽聽聽聽creator,STATUS聽as聽status聽,ISOPEN聽as聽isOpen聽,PICURL聽as聽picURL

聽聽聽聽聽聽聽聽FROM聽BLOG

聽聽聽聽 </ select >


聽聽聽聽 < insert聽 id ="insertBlog"

聽聽聽聽聽聽聽聽parameterClass ="com.renyao.ryblog.bean.Blog" >

聽聽聽聽聽聽聽聽INSERT聽INTO聽BLOG(TITLE,CONTENT,CREATETIME,MODIFYTIME)聽values

聽聽聽聽聽聽聽聽(#title#,聽#content#,聽#createTime#,聽#modifyTime#)

聽聽聽聽 </ insert >


聽聽聽聽 < update聽 id ="updateBlog"

聽聽聽聽聽聽聽聽parameterClass ="com.renyao.ryblog.bean.Blog" >

聽聽聽聽聽聽聽聽UPDATE聽BLOG聽SET聽TITLE聽=聽#title#,聽CONTENT=聽#content#,聽MODIFYTIME=

聽聽聽聽聽聽聽聽#modifyTime#聽WHERE聽BID聽=聽#bid#

聽聽聽聽 </ update >


聽聽聽聽 < delete聽 id ="deleteBlog"

聽聽聽聽聽聽聽聽parameterClass ="java.lang.Integer" >

聽聽聽聽聽聽聽聽DELETE聽BLOG聽WHERE聽BID聽=聽#bid#

聽聽聽聽 </ delete >

</ sqlMap >
5銆乻truts-config.xml閰嶇疆

<? xml聽version="1.0"聽encoding="UTF-8" ?>

<! DOCTYPE聽struts-config聽PUBLIC聽"-//Apache聽Software聽Foundation//DTD聽Struts聽Configuration聽1.2//EN"聽"http://struts.apache.org/dtds/struts-config_1_2.dtd" >

< struts-config >

聽聽聽聽 < data-sources聽 />

銆€銆€銆€銆€ <!-- 涓昏鏄痜orm-bean涓巃ction-mapping鐨勯厤缃紝鍓嶈€呯敤浜庡瓨鏀捐〃鍗曟彁浜ゅ悗鐨勬暟鎹紝鍚庤€呮寚瀹氬鐞咥ction -->

聽聽聽聽 < form-beans >

聽聽聽聽聽聽聽聽 < form-bean聽 name ="blogForm"

聽聽聽聽聽聽聽聽聽聽聽聽type ="com.renyao.ryblog.form.BlogForm" 聽 />

聽聽聽聽 </ form-beans >

聽聽聽聽 < global-exceptions聽 />

聽聽聽聽 < global-forwards >

聽聽聽聽聽聽聽聽 < forward聽 name ="blog" 聽path ="/pages/blog.do?method=list" ></ forward >

聽聽聽聽 </ global-forwards >

聽聽聽聽 < action-mappings >

聽聽聽聽聽聽聽聽 < action聽 input ="/pages/blog_edit.htm" 聽name ="blogForm"

聽聽聽聽聽聽聽聽聽聽聽聽parameter ="method" 聽path ="/pages/blog"

聽聽聽聽聽聽聽聽聽聽聽聽type ="com.renyao.ryblog.action.BlogAction" >

聽聽聽聽聽聽聽聽聽聽聽聽 < forward聽 name ="list" 聽path ="/pages/blog.do?method=list" 聽 />

聽聽聽聽聽聽聽聽聽聽聽聽 < forward聽 name ="success" 聽path ="/pages/blog_list.htm" 聽 />

聽聽聽聽聽聽聽聽聽聽聽聽 < forward聽 name ="view" 聽path ="/pages/blog_detail.htm" 聽 />

聽聽聽聽聽聽聽聽 </ action >

聽聽聽聽聽聽聽聽 < action聽 input ="/pages/blog_add.htm" 聽name ="blogForm"

聽聽聽聽聽聽聽聽聽聽聽聽parameter ="method" 聽path ="/pages/blogadd"

聽聽聽聽聽聽聽聽聽聽聽聽type ="com.renyao.ryblog.action.BlogAction" >

聽聽聽聽聽聽聽聽聽聽聽聽 < forward聽 name ="list" 聽path ="/pages/blog.do?method=list" 聽 />

聽聽聽聽聽聽聽聽聽聽聽聽 </ action >

聽聽聽聽 </ action-mappings >

聽聽聽聽 < message-resources

聽聽聽聽聽聽聽聽 parameter ="com.renyao.ryblog.ApplicationResources" 聽 />

</ struts-config >


6銆佹暣鍚坴elocity
灏唚eb.xml涓寚瀹氱殑涓や釜鏂囦歡锛宼oolbox.xml锛寁elocity.properties鏀懼埌鐩稿簲鐨勮礬寰勶紝杩樻湁vm_global_library.vm銆?
velocity.properties鐩稿簲璁劇疆濡備笅

<!-- directory鎸囧畾杈撳嚭鏂囦歡澶癸紝template鎸囧畾杈撳嚭妯℃澘椤?-->

velocimacro.library聽=聽/WEB-INF/VM_global_library.vm

input.encoding=GBK

output.encoding=GBK

default.contentType=text/html;聽charset=GBK

tools.view.servlet.layout.directory=pages聽聽聽

tools.view.servlet.layout.default.template=default.htm

toolbox.xml宸ュ叿绠辮缃ず渚?

<? xml聽version="1.0" ?>

< toolbox >

聽聽聽聽 < tool >

聽聽聽聽聽聽聽聽 < key > link </ key >

聽聽聽聽聽聽聽聽 < scope > request </ scope >

聽聽聽聽聽聽聽聽 < class > org.apache.velocity.tools.struts.StrutsLinkTool </ class >

聽聽聽聽 </ tool >

</ toolbox >
妯℃澘椤典唬鐮?

<! DOCTYPE聽HTML聽PUBLIC聽"-//W3C//DTD聽HTML聽4.01聽Transitional//EN" >

< html >

聽聽聽聽 < head >

聽聽聽聽聽聽聽聽 < title > Renyao聽Blog </ title >

聽聽聽聽聽聽聽聽 < meta聽 http-equiv ="keywords" 聽content ="keyword1,keyword2,keyword3" >

聽聽聽聽聽聽聽聽 < meta聽 http-equiv ="description" 聽content ="this聽is聽my聽page" >

聽聽聽聽聽聽聽聽 <!-- <link聽rel="stylesheet"聽type="text/css"聽href="./styles.css" target="_blank" rel="external nofollow" > -->

聽聽聽聽聽聽聽聽聽 < base聽 href ="$link.baseRef" >

聽聽聽聽 </ head >

聽聽聽聽 < body >

聽聽聽聽#parse('pages/header.htm')

聽聽聽聽聽$screen_content聽

聽聽聽聽聽#parse('pages/footer.htm')

聽聽聽聽 </ body >

</ html >

7銆佸悗鍙闆疄鐜?
闇€瑕佺紪鍐欑殑鏂囦歡锛欱log.xml,Blog.java,BlogForm.java,BlogAction.java,IBlogDAO.java---DAO鎺ュ彛,DefaultBlogDAO.java---瀹炵幇
鏀矽繘鐨勫湴鏂癸細閫氳繃缁ф壙涓庢帴鍙d紭鍖栦唬鐮佺粨鏋?涓昏浠g爜锛?a.BaseAction.java

package 聽com.renyao.ryblog.action;


import 聽org.apache.struts.action.ActionServlet;

import 聽org.apache.struts.actions.DispatchAction;

import 聽org.springframework.context.ApplicationContext;

import 聽org.springframework.web.context.support.WebApplicationContextUtils;

public 聽 class 聽BaseAction聽 extends 聽DispatchAction ... {
聽聽聽聽private聽ApplicationContext聽ac;
聽聽聽聽protected聽Object聽getBean(String聽beanName)...{
聽聽聽聽聽聽聽聽return聽ac.getBean(beanName);
聽聽聽聽}
聽聽聽聽public聽void聽setServlet(ActionServlet聽actionServlet)...{
聽聽聽聽聽聽聽聽if(actionServlet!=null)...{
聽聽聽聽聽聽聽聽聽聽聽聽super.setServlet(actionServlet);
聽聽聽聽聽聽聽聽聽聽聽聽ac=WebApplicationContextUtils.getRequiredWebApplicationContext(actionServlet.getServletContext());
聽聽聽聽聽聽聽聽}
聽聽聽聽}
}

b.BlogAction.java

package 聽com.renyao.ryblog.action;


import 聽java.sql.Date;

import 聽javax.servlet.http.HttpServletRequest;

import 聽javax.servlet.http.HttpServletResponse;

import 聽org.apache.struts.action.ActionForm;

import 聽org.apache.struts.action.ActionForward;

import 聽org.apache.struts.action.ActionMapping;

import 聽com.renyao.ryblog.DAO.iface.IBlogDAO;

import 聽com.renyao.ryblog.bean.Blog;

import 聽com.renyao.ryblog.form.BlogForm;

public 聽 class 聽BlogAction聽 extends 聽BaseAction聽 ... {
聽聽聽聽public聽ActionForward聽list(ActionMapping聽mapping,聽ActionForm聽form,
聽聽聽聽聽聽聽聽聽聽聽聽HttpServletRequest聽request,聽HttpServletResponse聽response)聽...{
聽聽聽聽聽聽聽聽try聽...{
聽聽聽聽聽聽聽聽聽聽聽聽request.setAttribute("blogs",聽((IBlogDAO)聽getBean("blogDAO"))
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽.getAllBlog());
聽聽聽聽聽聽聽聽聽聽聽聽return聽mapping.findForward("success");
聽聽聽聽聽聽聽聽}聽catch聽(Exception聽e)聽...{
聽聽聽聽聽聽聽聽聽聽聽聽return聽mapping.getInputForward();
聽聽聽聽聽聽聽聽}
聽聽聽聽}
聽聽聽聽public聽ActionForward聽view(ActionMapping聽mapping,聽ActionForm聽form,
聽聽聽聽聽聽聽聽聽聽聽聽HttpServletRequest聽request,聽HttpServletResponse聽response)聽...{
聽聽聽聽聽聽聽聽int聽bid聽=聽Integer.parseInt(request.getParameter("bid"));
聽聽聽聽聽聽聽聽Blog聽blog聽=聽((IBlogDAO)聽getBean("blogDAO")).getBlog(bid);
聽聽聽聽聽聽聽聽request.setAttribute("blog",聽blog);
聽聽聽聽聽聽聽聽return聽mapping.findForward("view");
聽聽聽聽}
聽聽聽聽public聽ActionForward聽delete(ActionMapping聽mapping,聽ActionForm聽form,
聽聽聽聽聽聽聽聽聽聽聽聽HttpServletRequest聽request,聽HttpServletResponse聽response)聽...{
聽聽聽聽聽聽聽聽int聽bid聽=聽Integer.parseInt(request.getParameter("bid"));
聽聽聽聽聽聽聽聽((IBlogDAO)聽getBean("blogDAO")).deleteBlog(bid);
聽聽聽聽聽聽聽聽return聽mapping.findForward("list");
聽聽聽聽}
聽聽聽聽public聽ActionForward聽update(ActionMapping聽mapping,聽ActionForm聽form,
聽聽聽聽聽聽聽聽聽聽聽聽HttpServletRequest聽request,聽HttpServletResponse聽response)聽...{
聽聽聽聽聽聽聽聽int聽bid聽=聽Integer.parseInt(request.getParameter("bid"));
聽聽聽聽聽聽聽聽Date聽modifyTime聽=聽new聽Date(System.currentTimeMillis());
聽聽聽聽聽聽聽聽Blog聽blog聽=聽((IBlogDAO)聽getBean("blogDAO")).getBlog(bid);
聽聽聽聽聽聽聽聽blog.setContent(((BlogForm)form).getContent());
聽聽聽聽聽聽聽聽blog.setTitle(((BlogForm)form).getTitle());
聽聽聽聽聽聽聽聽blog.setModifyTime(modifyTime);
聽聽聽聽聽聽聽聽((IBlogDAO)getBean("blogDAO")).updateBlog(blog);
聽聽聽聽聽聽聽聽return聽mapping.findForward("list");
聽聽聽聽}
聽聽聽聽public聽ActionForward聽insert(ActionMapping聽mapping,聽ActionForm聽form,
聽聽聽聽聽聽聽聽聽聽聽聽HttpServletRequest聽request,聽HttpServletResponse聽response)聽...{
聽聽聽聽聽聽聽聽Blog聽blog聽=聽null;
聽聽聽聽聽聽聽聽String聽title聽=聽((BlogForm)聽form).getTitle();
聽聽聽聽聽聽聽聽String聽content聽=聽((BlogForm)聽form).getContent();
聽聽聽聽聽聽聽聽Date聽date聽=聽new聽Date(System.currentTimeMillis());
聽聽聽聽聽聽聽聽blog.setContent(content);
聽聽聽聽聽聽聽聽blog.setTitle(title);
聽聽聽聽聽聽聽聽blog.setCreateTime(date);
聽聽聽聽聽聽聽聽blog.setModifyTime(date);
聽聽聽聽聽聽聽聽((IBlogDAO)聽getBean("blogDAO")).insertBlog(blog);
聽聽聽聽聽聽聽聽return聽mapping.findForward("list");
聽聽聽聽}
}
聽
聽
聽
聽