struts.xml文件布置
来源:互联网 发布:淘宝达人推广怎么收费 编辑:程序博客网 时间:2024/04/28 04:04
这个配置文件搞了我半天,气得我半死,终于在中午12点搞定,下面来说说
我的配置文件如下
<?xml version="1.0" encoding="GBK"?><!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" "http://struts.apache.org/dtds/struts-2.3.dtd"><struts><package name="default" namespace="" extends="struts-default"><action name="hello" class="hello.HelloAction"><result name="success">/hello.jsp</result></action></package></struts>
有三部分要注意
一:这里的版本信息要写对,我用的是2.3.16.1,但这里只要写2.3就行了,如果你的XML文件中没有写这个,
更要加上!!
二:这里name后面的default代表是缺省的包名,是指struts.xml直接放在src目录下,
最好放在这个目录下,
不然很可能读取不到里面的信息,
如果你的action类写在多层包下(如com.bag.actions),那么这里的namespace="/"要加上,
否则容易出错
<package name="default" namespace="" extends="struts-default">
三:注意XML文件中的一些拼写错误,这是粗心
四:这里的action name 要和你的前端页面中的action要一致,
否则也会出错
<action name="hello" class="hello.HelloAction">
五:2.1版本以上的用这个过滤类(web.xml中)
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
0 0
- struts.xml文件布置
- struts-config.xml文件
- struts.xml文件结构
- struts.xml文件详解
- struts 的xml文件
- struts.xml文件模板
- struts.xml文件结构
- struts.xml 文件
- struts.xml文件详解
- struts.xml 文件结构
- struts.xml 文件配置
- struts.xml文件配置
- struts.xml 文件
- struts.xml文件详解
- struts中struts-config.xml文件解释
- struts-config.xml文件详解
- struts-config.xml文件详解
- 浅析struts-config.xml文件
- Android4.2 Camera子系统
- Cracking The Coding Interview 4.4
- 非技术人员往往要身兼数职
- 数据结构 序列
- 使用CocoaPods来做iOS程序的包依赖管理
- struts.xml文件布置
- Android开发Widget
- 高效能程序员的七个习惯
- IC成本
- Ubuntu 12.04 最小安装 gnome fallback 桌面及中文环境
- 【C语言】 qsort 的使用
- cookie技术简介
- 工业毛刷的发展运用
- WebView中多次跳转网页时 TextView文本不能输入值 和不能弹出输入框的问题解决