Struts 开发的最佳实践(含外文出处)
来源:56doc.com 资料编号:5D12455 资料等级:★★★★★ %E8%B5%84%E6%96%99%E7%BC%96%E5%8F%B7%EF%BC%9A5D12455
资料以网页介绍的为准,下载后不会有水印.资料仅供学习参考之用. 密 保 惠 帮助
资料介绍
Struts 开发的最佳实践(含外文出处)(中文1900字,英文1500字)
摘要:本文简要的介绍了Struts 作为一种开源框架,可用来构建 Web 应用程序,它基于流行的 Model-View-Controller (MVC2) 设计范型。该框架构建在一些标准的技术之上,比如 Java Servlets、JavaBeans、ResourceBundles 和 XML,并且可提供灵活和可扩展的组件。Struts 以ActionServlet 的形式实现了 Controller 层,并建议使用 JSP 标记库构建 View 层。Struts 通过 Action 类提供了围绕 Model 层的包装器。
关键字:Struts MVC 数据库实例 JavaBeans
BEST PRACTICES FOR STRUTS DEVELOPMENT
Palaniyappan Thiagarajan, Pagadala Suresh
Overview of Struts components
First, we'll explain the Struts components in the context of best practices and the role each one plays in your Web application development.
Action
Every Action of your application extends Struts' org.apache.struts.action.Action. These Action classes provide an interface to the application's Model layer, acting as a wrapper around the business logic. Each Action class must provide its case-specific implementation to the perform() method. The perform() method always returns a value of type ActionForward.
ActionForm
Every ActionForm ofyour application extends Struts' org.apache.struts.action.ActionForm. ActionForms are simple JavaBeans that encapsulate and validate request parameters. To validate your request data, your ActionForm's validate() method must give a case-specific implementation. ActionForms serve as a carrier of request data to the Action class. A JSP object combines with a respective ActionForm to form your application's View layer, where almost every form field of the JSP object maps to an attribute of the corresponding ActionForm. |