webwork培训.ppt





《webwork培训.ppt》由会员分享,可在线阅读,更多相关《webwork培训.ppt(30页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、2目录oWebWork入门oWebWork原理oWebWork标签库和ELoWebWork实例3WebWork原理MVC模式oMVC最初是在Smalltalk-80中被用来构建用户界面oModel实现了应用领域的业务模型oView用来展现模型中的数据和内部状态oControl也称为Dialog,它协调Model与View,把用户请求翻译成系统识别的事件4J2ee Web Framework之现状oWebWork: 最灵活、简单的Web框架oSpring Web Framework:最全面的Web框架oStruts: 资源最丰富的Web框架oTapestry: 组件化最完美的Web框架oJSF:
2、 最接近的Web框架oPortal: 最适合集成的Web框架5WebWork概述XWork 1WebWork 1WebWork 2 Web Non-web6Actiono请求的动作都对应于一个相应的Actiono一个Action是一个独立的工作单元和控制命令o它必需要实现XWork里的Action接口public interface Action extends Serializable public static final String SUCCESS = success; public static final String NONE = none; public static fina
3、l String ERROR = error; public static final String INPUT = input; public static final String LOGIN = login; public String execute() throws Exception;7例子用户注册register.jspxwork.xmlregisterSuccess.jspregister.action8ActionSupport提供提供Action常用功能的一个基类常用功能的一个基类p错误消息的支持action and field specific errorsfield e
4、rrors are automatically supported by viewsp国际化支持1 resource bundle per actionpervasive UI support for retrieving messages9ActionContexto一次Action调用都会创建一个ActionContexto调用:ActionContext context = ActionContext.getContext()o在WebWork中,它通过包装提供了对Servlet的访问:HttpSession context.getSession()HttpServletRequest
5、parameters context.getParameters()pServletActionContext,继承ActionContext。可以直接访问servlet相关的API:PageContext,HttpServletRequest,HttpServletResponse,ServletConfig,ServletContext10二、WebWork原理XWork的层次:ActionProxyActionInvocationActionActionProxy:管理Action的生命周期,它是设置和执行Action的起始点。ActionInvocation:在ActionProxy层
6、之下,它表示了Action的执行状态。它持有Action实例和所有的Interceptor11WebWork原理12InterceptorsoPractical AOPnvery simple, no external dependencies nallows you to intercept action invocationsoHelp decouple and componentize your codeoInterceptors are organized into stacksnlists of interceptors applied in sequence.napplied to
7、 any action or package of actionsoWebWork is mostly implemented as a series of XWork interceptors13例子 TimerInterceptor public class TimerInterceptor implements Interceptor . . .public String intercept(ActionInvocation dispatcher) .long startTime = System.currentTimeMillis(); String result = dispatch
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- webwork 培训

限制150内