Struts2命令空间小结
sturts2命名空间小结,以tomcat为服务器
1. 命名空间配置为“/”
<package name="default" namespace="/" extends="struts-default">
<action name="HelloWorld" class="com.venn.action.HelloWorldAction">
<result>/jsp/test.jsp</result>
</action>
</package>
访问地址1:http://localhost:8080/HelloWorld/HelloWorld.action
但是,用 http://localhost:8080/HelloWorld/path1/path2/path3/HelloWorld.action 同样可以访问
2.命名空间为具体路径,如“/path1/path2”
<package name="default" namespace="/path1/path2" extends="struts-default">
<action name="HelloWorld" class="com.venn.action.HelloWorldAction">
<result>/jsp/test.jsp</result>
</action>
</package>
访问地址:http://localhost:8080/HelloWorld/path1/path2/HelloWorld.action
如果使用: http://localhost:8080/HelloWorld/path1/path2/path3/HelloWorld.action 同样可以访
总结:struts2中搜索Action的机制:
1.如果命名空间存在,就在命名空间中找Action
2.如果命名空间不存在,就在当前命名空间的上一级找Action,依次类推,直到根命名空间 “/”,找不到则抛出异常
Struts2命令空间小结的更多相关文章
- C#设置有命令空间的属性
之前被问到一个问题,C#中如何设置android:name这样的属性?我的第一反应是直接setAttribute不就可以了么 SetAttribute(name, value), 可事实上却不行,因为 ...
- ref:Struts2 命令执行系列回顾
ref:http://www.zerokeeper.com/vul-analysis/struts2-command-execution-series-review.html Struts2 命令执行 ...
- Python argparse 处理命令行小结
Python argparse 处理命令行小结 1. 关于argparse是python的一个命令行解析包,主要用于处理命令行参数 2. 基本用法test.py是测试文件,其内容如下: import ...
- C++命令空间使用和编译
先创建目录结构 src bin obj lib include 1.创建命名空间 创建一个头文件include/head.h; #ifndef _GOOD_H #define _GOOD_H name ...
- sv命令空间 packge
SV中的module,interface,program,checker,都提供declaration空间,内部定义都local当前的那个scope,相互之间的building block不影响,不识 ...
- mount、umount、fuser命令使用小结
mount -t cifs -o username=administrator,password=xxxxx //192.168.11.17/Data/ /mnt/databak/之后想卸载挂载目录, ...
- curl命令使用小结[转]
curl命令有不少小技巧,linux下测试确实很方便.转http://blog.csdn.net/zhangliang_571/article/details/26379777 1.开启gzip请求c ...
- Linux lsof命令使用小结
lsof(list open files)是一个列出当前系统打开文件的工具.在Linux环境下,任何事物都是以文件的形式存在,通过文件不仅可以访问常规数据,还可以访问网络连接和硬件.所以,如传 ...
- Struts2 interceptor使用经验小结
1. interceptor 调用Spring容器中的bean 在interceptor中常有需要调用Spring Bean的需要,其实很简单和Struts2的Action一样配置即可. Spring ...
随机推荐
- Windows API 之 InternetOpen、InternetOpenUrl、InternetReadFile
InternetOpen: Initializes an application's use of the WinINet functions. HINTERNET InternetOpen( _In ...
- English--Computer System
A: Hey, Bill, Can you tell what's wrong with my computer? I can't move the mouse, I can's user the k ...
- Mac linux 安装memcached服务 用法
今天在Mac上安装memcached服务的时候 由于安装memcached之前需要安装libevent依赖包 所以使用brew install libevent 安装过程中报错 Warning: Yo ...
- new del 问题
实验一: new_del_caller工程(静态库) -new_del_caller.cpp #include <new> void new_del_caller() { ]; delet ...
- OpenGL------三维变换
我们生活在一个三维的世界——如果要观察一个物体,我们可以:1.从不同的位置去观察它.(视图变换)2.移动或者旋转它,当然了,如果它只是计算机里面的物体,我们还可以放大或缩小它.(模型变换)3.如果把物 ...
- opencv-jni -调试出错taking address of temporary [-fpermissive]
今天在进行代码往安卓平台移植时,IplImage *qImg=&(IplImage)dst1;报错taking address of temporary [-fpermissive] 百度了一 ...
- LINQ To SQL && Lambda 使用方法小结 (转)
1. 查询Student表中的所有记录的Sname.Ssex和Class列.select sname,ssex,class from studentLinq: from s in Students ...
- DWR整合之JSF
DWR 与 JSF DWR 包括两个 JSF 的扩展点,一个创造器和一个 ServletFilter. 1.JSF Creator DWR1.1 中有一个体验版的 JsfCreator.你可以在 dw ...
- android studio 学习进阶
1,下载地址 :http://pan.baidu.com/s/1eQxO1MU#path=%252FAndroid-Studio
- git使用时遭遇the authenticity of host can't be established
修改/etc/ssh/ssh_config文件的配置,以后则不会再出现此问题 最后面添加: StrictHostKeyChecking no UserKnownHostsFile /dev/null