Struts2学习笔记——Namespace
来源:互联网 发布:做淘宝店铺用什么软件 编辑:程序博客网 时间:2024/04/23 23:35
namespace决定了action的访问路径,默认为"",可以接收所有路径的action
namespace可以写为/,或者/xxx,或者/xxx/yyy,对应的action访问路径为/index.action,/xxx/index.action,或者/xxx/yyy/index.action.
namespace可以写为/,或者/xxx,或者/xxx/yyy,对应的action访问路径为/index.action,/xxx/index.action,或者/xxx/yyy/index.action.
namespace最好也用模块来进行命名
Struts.xml:
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE struts PUBLIC"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN""http://struts.apache.org/dtds/struts-2.3.dtd"><struts> <constant name="struts.devMode" value="true" /> <package name="front" namespace="/front" extends="struts-default"> <!-- <default-action-ref name="index" /> --> <!-- 配置默认的访问路径 --> <action name="index"> <result> /Namespace.jsp </result> </action> </package> <package name="main" namespace="" extends="struts-default"> <!-- <default-action-ref name="index" /> --> <!-- 配置默认的访问路径 --> <action name="index"> <result> /Namespace.jsp </result> </action> </package> <!-- Add packages here --></struts>Namespace.jsp:
<?xml version="1.0" encoding="GB18030" ?><%@ page language="java" contentType="text/html; charset=GB18030" pageEncoding="GB18030"%> <%@taglib uri="/struts-tags" prefix="s" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=GB18030" /><title>Insert title here</title></head><body>namespace决定了action的访问路径,默认为"",可以接收所有路径的action<br />namespace可以写为/,或者/xxx,或者/xxx/yyy,对应的action访问路径为/index.action,/xxx/index.action,或者/xxx/yyy/index.action.<br/>namespace最好也用模块来进行命名</body></html>然后我们在访问http://localhost:8080/Struts2_0200_Namespace/index和http://localhost:8080/Struts2_0200_Namespace/front/index的时候都可以访问到我们的Namespace.jsp
0 0
- Struts2学习笔记——Namespace
- Struts2 学习笔记 —— 02 —— Namespace
- Struts2学习笔记三——Namespace与访问路径
- Struts2 学习笔记02 Namespace
- 关于Struts2 namespace 的学习笔记(DMI动态方法调用)
- Struts2学习笔记之package元素中的namespace搜索规则
- HBase学习笔记——命名空间(namespace)
- struts2 命名空间 namespace 学习
- Struts2学习笔记——Struts2原理
- Struts2学习笔记——Struts2概览
- namespace学习笔记
- Struts2学习笔记—通配符
- Struts2学习(三):namespace属性的使用
- struts2学习:配置篇之namespace
- Struts2学习(三):namespace属性的使用
- struts2学习:配置篇之namespace
- [Struts2 框架学习] 二、Namespace 和 Action
- HBase学习笔记 --- namespace操作
- 工欲善其事必先利其器之Git
- Struts2 poi导出excel
- Spring MVC报错:The request sent by the client was syntactically incorrect ()
- sqlite基本使用方法
- 白话Aulolayout
- Struts2学习笔记——Namespace
- OC核心语法(2)构造函数
- WinCE6.0的EBOOT概要
- 常用工具
- HDU 1754 I Hate It(入门线段树)
- (三)洞悉linux下的Netfilter&iptables:内核中的rule,match和target
- UVA839 Not so Mobile【二叉树】【递归】
- JAVA 关于国际象棋棋盘的扩展
- APP云测试