外文翻译-Spring的web-MVC-构架模式讲解学习 - 百度文库

2025/5/7 8:32:08

ĸ2

һֻHibernateStrutsJ2EEӦÿ

ķHibernateStrutsĻƣһֻHibernateStrutsJ2EEӦÿԡֲУģͲHibernateʵ֣ͼͿStrutsʵ֡ɴ󽵵ʹԼϵͳĿЧʡ

ؼ HibernateStrutsMVC־ò 1

Java𽥳ƣΪҵӦõı׼ƽ̨J2EEƽ̨õ˳ķչJ2EE淶аĶEnterprise JavaBean(EJB)Java Servlets(Servlet)Java Server Pages(JSP)Java Message Service(JMS)ȣӦϵͳǣڴͳJ2EEӦõĿҲһЩ⣺

1ģͺ߼ģ֮ìܡĿǰʹõݿ϶ǹϵݿ⣬Javaһԣڴ洢ͶȡʱʹSQLJDBCݿ˱̵ЧԼϵͳĿάԣ

2ͳJ2EEӦöûEJBܣֿʺڿҵӦãʹEJBп͵ҪķѴʱ䡣Ϊ˽ʹԣϵͳĿЧʣһֻStrutsܺHibernateܵJ2EEӦÿԡ

2 ݳ־ò㼰Hibernate Hibernateһݳ־òܣһʵֶ͹ϵ֮ӳ䣨O/R MappingĹߣJDBCĶװʹԱʹö˼ݿ⡣ṩ˴Javaൽݱӳ䣬ҲṩݲѯͻָơʹJDBCSQLݿ⣬ʹHibernateܴʵֵЧʡHibernateļʽJavaݱ֮ӳϵͬʱڸIJ潫ݱ֮ĹϵΪJava֮ļ̳мȹϵͨʹHQL佫ӵĹϵ

öķʽں̶ܴϼ˶ݵIJѯӿ˿ЧʡHibernateһ򵥶ֱ۵APIڶݿʾĶִвѯҪ޸ЩֻڳǽнȻHibernate漴ɡװ־ûҵ߼ҪдJDBC䣬Ӷʹݳ־òõ˼ļ򻯡

3 StrutsʵMVCܹ MVCModel-View-ControllerTrygve ReenskaugȱӦSmallTalk-80УཻͽϵͳĹɻݽƿɱԵMVCѽϵͳɷֽģ͡ͼ֡ ģͣModel߼ڶʾݺʽµڳ󣬷װĺݡ߼͹ܵļϵھĽI/OͼViewѱʾģݼ߼ϵ״̬ϢضʽչʾûģͻʾϢͬϢжͬʾʽͼControllerǴûĽģְǿṩģκα仯ĴȷûģͼĶӦϵû룬뷴ģͣʵֶģ͵ļƣʹģͺͼЭIJͨһͼӦһģ͡ͼķ룬ʹһģͿԾжʾͼûͨijͼĿıģ͵ݣЩݵͼӦӳЩ仯ˣۺʱ˺ݱ仯Ὣ仯֪ͨеͼʾĸ¡ʵһģ͵ı仯-ơ

StrutsΪApache JakartaĿɲ̳MVCĸԣJ2EEص㣬Ӧı仯չStrutsܺܺõĽJspJava ServletJava BeanTaglibȼStrutsУеMVCпɫActionServletActionServletһͨõĿṩ˴з͵StrutsHTTPڵ㡣ȡ ַЩӦĶࣨЩ඼ActionࣩҲӦAction FormFromBeanࣨActionBeanʺҵ߼Java BeanEJBѿȨ

JSPļJSPļͼЩ߼

Struts-config.xmlļáStrutsУͼҪJSPҳɣStrutsṩḻJSPǩ⣬ڷֿ߼ͳ߼ģһJava BeanʽڡStrutsУҪBeanֱǣActionActionFormEJBJava Bean Strutsûо嶨ģͲʵ֣ʵʿУģͲͨǺҵ߼ģҪԵײݽвһֿԣHibernate뵽StrutsܵģͲУʹݷװӳ䣬ṩ־û֧֡

4 HibernateStrutsJ2EEӦ

J2EEӦзdzձû¼Ϊ˵ϵṹξõġ¼̷dzûӵ¼ҳlogin.jsp¼ϢϵͳԵ¼Ϣ֤ȷɹ¼ʾӦϢ ڿУʹEclipseΪͬʱ˶StrutsHibernateṩõĿƺֵ֧ĵMyEclipseWebʹTomcatݿѡMysql ȶHibernateãֻҪϵͳԶɵ

hibernate.cfg.xml޸ģúݿӵĸֲԼӳļHibernateӳҪڲԣܲǺܺãͨJNDI޸ΪʹTomcatӳء

ԭ1ӡ壩

Web MVC with the Spring Framework

Juergen Hoeller

1. Introduction: Spring the Application Framework

When first confronted with the Spring Framework, one might be tempted to think: \particularly a web framework but a generic lightweight application framework with dedicated web support, and show the architectural differences to Struts and WebWork In contrast to Struts or WebWork, Spring is an application framework for all layers: It offers a bean configuration foundation, AOP support, a JDBC abstraction framework, abstract transaction support, etc. It is a very non-intrusive effort: Your application classes do not need to depend on any Spring classes if not necessary, and you can reuse every part on its own if you like to. From its very design, the framework encourages clean separation of tiers, most importantly web tier and business logic: e.g. the validation framework does not depend on web controllers. Major goals are reusability and testability: Unnecessary container or framework dependencies can be considered avoidable evils.

Of course, Spring's own web support is nicely integrated with the framework's general patterns. Nevertheless, replacing the web solution with Struts, WebWork, or the like is easy. Both with Spring's web support or a different one, Spring allows for building a true dedicated middle tier in the web container, with the option to reuse exactly the same business logic in test environments or standalone applications. And within J2EE, your business logic will not unnecessarily depend on container services like JTA or EJB - allowing complex, well-architected web applications to run in a \container like Tomcat or Resin.

Note that Spring doesn't generally aim to compete with existing solutions. It rather fosters seamless integration with standards like Servlet, JSP, JTA, JNDI, JDBC, and JDO, and well-suited tools like Hibernate, Velocity, Log4J, and Caucho's Hessian/Burlap. The framework is designed to grow with the needs of your applications, in terms of technology choice: For example, you will probably use JTA


外文翻译-Spring的web-MVC-构架模式讲解学习 - 百度文.doc ĵWordĵص
ڣ 外文翻译-Spring的web-MVC-构架模式讲 ĵ
Ƽ
Ķ
ͨغɸƺŰ棩

ͨԱ

ͨԱĵɸƺأŵѡ񣬸Ͽ԰ɣ

ƪأ10Ԫ

עĵпܡֻĿ¼ݲȫ֮ǰעѸ޷ػ⣬ϵЭ㴦
΢ţfanwen365 QQ370150219