資源簡介
應用Struts1+Hibernate+Spring開發的一套Demo,實現一個表數據的增刪改查

代碼片段和文件信息
package?com.steven.hibernatet.action;
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?org.apache.struts.actions.DispatchAction;
import?org.springframework.context.ApplicationContext;
import?org.springframework.context.support.FileSystemxmlApplicationContext;
import?com.steven.hibernatet.entity.Street;
import?com.steven.hibernatet.form.StreetForm;
import?com.steven.hibernatet.service.TextService;
/**
?*?測試用的Action,此類為頁面接收類,是Struts中配置的類?create?on?2011-08-05
?*?
?*?@author?Steven
?*?
?*/
public?class?TextAction?extends?DispatchAction?{
public?ActionForward?list(ActionMapping?mapping?ActionForm?form
HttpServletRequest?request?HttpServletResponse?response)?{
//?通過文件加載Spring配置,可以做一個工廠來完成,或者可以用Struts和Spring兼容的方式,
//或者應用實現ApplicationContextAware的方式,這里的demo簡單實現
ApplicationContext?context?=?new?FileSystemxmlApplicationContext(
“classpath:applicationContext.xml“);
TextService?service?=?(TextService)?context.getBean(“textService“);
request.setAttribute(“listStreet“?service.listStreet());
return?mapping.findForward(“list“);
}
public?ActionForward?saveStreet(ActionMapping?mapping?ActionForm?form
HttpServletRequest?request?HttpServletResponse?response)?{
ApplicationContext?context?=?new?FileSystemxmlApplicationContext(
“classpath:applicationContext.xml“);
TextService?service?=?(TextService)?context.getBean(“textService“);
StreetForm?tForm?=?(StreetForm)?form;
Street?street?=?new?Street();
street.setId(tForm.getId());
street.setName(tForm.getName());
service.saveStreet(street);
return?this.list(mapping?tForm?request?response);
}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????2556??2011-08-05?21:43??sshtext\.classpath
?????文件????????548??2011-08-05?14:48??sshtext\.myhibernatedata
?????文件????????294??2011-08-05?21:23??sshtext\.myme
?????文件????????262??2011-08-05?14:47??sshtext\.mystrutsdata
?????文件???????1906??2011-08-05?15:05??sshtext\.project
?????文件????????462??2011-08-05?14:49??sshtext\.springBeans
?????文件?????????52??2011-09-13?22:21??sshtext\readme.txt
?????文件????????314??2011-08-05?15:39??sshtext\WebRoot\index.jsp
?????文件????????505??2011-08-05?22:12??sshtext\WebRoot\WEB-INF\.struts-config.mex
?????文件???????8860??2011-08-05?14:47??sshtext\WebRoot\WEB-INF\struts-bean.tld
?????文件????????605??2011-08-05?22:12??sshtext\WebRoot\WEB-INF\struts-config.xm
?????文件??????73617??2011-08-05?14:47??sshtext\WebRoot\WEB-INF\struts-html.tld
?????文件??????14731??2011-08-05?14:47??sshtext\WebRoot\WEB-INF\struts-logic.tld
?????文件??????71483??2011-08-05?14:47??sshtext\WebRoot\WEB-INF\struts-nested.tld
?????文件???????7842??2011-08-05?14:47??sshtext\WebRoot\WEB-INF\struts-tiles.tld
?????文件??????13468??2011-08-05?14:47??sshtext\WebRoot\WEB-INF\validator-rules.xm
?????文件???????1263??2011-08-05?21:40??sshtext\WebRoot\WEB-INF\web.xm
?????文件?????443432??2011-08-05?14:48??sshtext\WebRoot\WEB-INF\lib\antlr-2.7.6.jar
?????文件?????278682??2011-08-05?14:48??sshtext\WebRoot\WEB-INF\lib\cglib-2.2.jar
?????文件?????559366??2011-08-05?14:48??sshtext\WebRoot\WEB-INF\lib\commons-collections-3.1.jar
?????文件?????465668??2011-08-05?14:48??sshtext\WebRoot\WEB-INF\lib\derbyclient.jar
?????文件?????313898??2011-08-05?14:48??sshtext\WebRoot\WEB-INF\lib\dom4j-1.6.1.jar
?????文件?????208048??2011-08-05?14:48??sshtext\WebRoot\WEB-INF\lib\ehcache-1.2.3.jar
?????文件??????50583??2011-08-05?14:48??sshtext\WebRoot\WEB-INF\lib\ejb3-persistence.jar
?????文件?????279714??2011-08-05?14:48??sshtext\WebRoot\WEB-INF\lib\hibernate-annotations.jar
?????文件??????66993??2011-08-05?14:48??sshtext\WebRoot\WEB-INF\lib\hibernate-commons-annotations.jar
?????文件?????119292??2011-08-05?14:48??sshtext\WebRoot\WEB-INF\lib\hibernate-entitymanager.jar
?????文件??????62574??2011-08-05?14:48??sshtext\WebRoot\WEB-INF\lib\hibernate-validator.jar
?????文件????2421736??2011-08-05?14:48??sshtext\WebRoot\WEB-INF\lib\hibernate3.jar
?????文件?????597476??2011-08-05?14:48??sshtext\WebRoot\WEB-INF\lib\javassist-3.9.0.GA.jar
............此處省略69個文件信息
評論
共有 條評論