struts2学习记录
来源:互联网 发布:信管专业考研方向知乎 编辑:程序博客网 时间:2024/06/14 11:11
1. 拷贝必须的jar文件.直接拖动到WebRoot/WEB-INF/lib下
commons-fileupload-1.2.1.jar
commons-io-1.3.2.jar
freemaker-2.3.16.jar
javassist-3.7.ga.jar
ognl-3.0.jar
struts2-core-2.2.1.jar
xwork-core-2.2.1.jar
2. web.xml进行配置
<?xml version="1.0" encoding="GBK"?><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"><!-- 定义Struts2的核心Filter --><filter><filter-name>struts2</filter-name><filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class></filter><!-- 让Struts2的核心Filter拦截所有请求 --><filter-mapping><filter-name>struts2</filter-name><url-pattern>/*</url-pattern></filter-mapping></web-app>
3.struts.xml的配置,注意不是struts2.xml,在src/目录下,编译时自动拷贝到WEB-INF/classes文件下
<?xml version="1.0" encoding="GBK"?><!DOCTYPE struts PUBLIC"-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN""http://struts.apache.org/dtds/struts-2.1.7.dtd"><!-- 指定Struts 2配置文件的根元素 --><struts><!-- 指定全局国际化资源文件 --><constant name="struts.custom.i18n.resources" value="mess"/><!-- 指定国际化编码所使用的字符集 --><constant name="struts.i18n.encoding" value="GBK"/><!-- 所有的Action定义都应该放在package下 --><package name="lee" extends="struts-default"><action name="login" class="org.crazyit.app.action.LoginAction"><!-- 定义三个逻辑视图和物理资源之间的映射 --><result name="input">/login.jsp</result><result name="error">/error.jsp</result><result name="success">/welcome.jsp</result></action></package></struts>
4.访问路径为http://localhost:8080/工程名/页面名
页面名(login.jsp)
0 0
- Struts2学习记录
- struts2 学习记录
- Struts2学习记录
- struts2学习记录
- Struts2学习记录1
- 学习Struts2的记录
- Struts2学习记录
- Struts2学习记录(1)
- Struts2 学习记录(2)
- Struts2 学习记录(3)
- Struts2 学习记录(4)
- Struts2 学习记录-第一天
- Struts2框架学习记录1
- struts2的dojo插件一些学习记录
- struts2 标签学习记录(一)
- 【ssh2学习记录】1、struts2框架入门
- Struts2学习记录(Struts2各项配置文件解析)
- struts2视频学习错误记录1-7讲
- vc2008界面的一些配置
- iptables日志探秘
- Freemarker(二)语法介绍
- 2014年12月30日,今天着重谈谈tar。
- HDOJ 2570 迷瘴
- struts2学习记录
- Mondrian MDX简介
- 设计模式之单例模式(Singleton)
- 使用ThinkPHP框架快速搭建网站
- [leetcode]Best Time to Buy and Sell Stock III
- nyoj 484 the famours clock
- 26-UI基础通过代码创建九宫格
- 27-UI基础字典转模型与xib的使用
- APP切图流程和APP切图命名规范详细完整版