[计算机软件及应用]马士兵Struts2学习笔记2011.docVIP

  • 3
  • 0
  • 约3.03万字
  • 约 34页
  • 2018-03-09 发布于浙江
  • 举报

[计算机软件及应用]马士兵Struts2学习笔记2011.doc

[计算机软件及应用]马士兵Struts2学习笔记2011

目录 ? 建立一个Struts2 工程 - 2 - ? 用Action的属性接收参数 - 10 - ? 使用Domain Model (实体模型) 接收参数 - 11 - ? Struts2_2.1.6版本的中文问题 - 12 - ? Struts模块包含 - 12 - ? Struts简单数据验证 13 ? Struts ValueStack(值栈) Debug 15 Value Stack Contents 15 ? Struts2_访问Web元素 16 Stack Context 18 第二种方式(这种方式是最常用的,其他的都可以忘记) 18 ? Action总结 19 ? Struts2_结果类型 20 ? OGNL 22 Struts ValueStack Debug 23 Value Stack Contents 23 ? Struts投影 28 建立一个Struts2 工程 1在MyEclipse中新建web工程 2在struts--all\struts-解压struts2-blank.war( 最基础的示例程序 ) 3进入struts-\apps\struts2-blank\WEB-INF\classes下把struts.xml拷到web工程的src下面,因为工程编译完它默认就把src下的文件放到class文件下面。 、 4.拷类库,在这个项目的lib文件下面拷 把jar放入lib后看不见jar文件,是因为MyEclipse默认视图是package Explorer,如果要看硬盘上对应的视图,应该打开windows-Show View-other-navigatior 4.配置web.xml,参考struts自带的web.xml,把filter的配置拷过来 filter filter-namestruts2/filter-name filter-classorg.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter /filter-class /filter filter-mapping filter-namestruts2/filter-name url-pattern/*/url-pattern /filter-mapping 第一个示例程序Hello Struts struts constant name=struts.devMode value=true / package name=default namespace=/ extends=struts-default action name=hello result/hello.jsp/result /action /package /struts http://localhost:8080/strust2_0100_Introduction/ http://localhost:8080/strust2_0100_Introduction/hello 或者 http://localhost:8080/strust2_0100_Introduction/hello.action 跳转到hello.jsp,第一个示例程序成功! Struts2读源码 配置文件中的 filter-classorg.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter /filter-class 一看就应该知道它是对应一个类,在jar文件中找到对应的源码编译完的class文件, 查看源码: jar文件点右键(properties--(Java Source Attachment(External Folder (外部文件) (struts--all/struts-/src/core/src/main/java 点击class文件可以查看源码了,假如想看它的doc文档,同样的方法 jar文件点右键(properties--(Javadoc Location-(导入doc就可以在源码中右键或者F1观察对应的文档了。 敲尖括号不提示的问题 Struts.xml文件头定义了 !DOCTYPE struts PUBLIC -//Apache Software Foundation//DTD Struts Configuration 2.0//EN /dtds/struts-2.0.dtd 配置:windowspreferencescatalog。。。xml—xml Catalog—Add Ad

文档评论(0)

1亿VIP精品文档

相关文档