struts2之namespace
来源:互联网 发布:淘宝的图片 编辑:程序博客网 时间:2024/05/18 10:46
1.struts.xml
<span style="font-size:18px;"><?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> <!-- Add packages here --> <constant name="struts.devMode" value="true" /><package name="default"<span style="color:#ff0000;"> namespace="/"</span> extends="struts-default"> <action name="hello"> <result> /Hello.jsp </result> </action> </package></struts></span>说明:namespace可以为"/",也可以为空,也可以为/xxx/xxx.action等,这样的话访问的路径就会有所不同。这个点需要注意,如果访问路径中namespace写错,编译器就会报there is no action......的异常。
2.hello.jsp
<span style="font-size:18px;"><%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%><%String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <base href="<%=basePath%>"> <title>HelloStruts2</title><meta http-equiv="pragma" content="no-cache"><meta http-equiv="cache-control" content="no-cache"><meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"><meta http-equiv="description" content="This is my page"><!--<link rel="stylesheet" type="text/css" href="styles.css">--> </head> <body> Hello Struts2 <br> </body></html></span>
0 0
- struts2之namespace
- struts2学习:配置篇之namespace
- Struts2注解配置之@Namespace(四)
- struts2系列二之namespace 的使用
- Struts2注解配置之@Namespace(四)
- struts2学习:配置篇之namespace
- Struts2注解配置之@Namespace(四)
- Struts2注解配置之@Namespace(四)
- struts2 namespace
- Struts2 namespace
- struts2 namespace
- struts2 namespace:
- Struts2-namespace
- Struts2 namespace
- Struts2-namespace
- struts2 namespace
- Struts2 namespace
- Struts2基础之二:namespace和自定义action
- 直接操作语言对象
- [总结]PHP正则表达式
- Gearman GearmanClient 函数列表
- 每天学习十分钟20之git笔记②
- Charles 关闭之后 手机、苹果电脑能上QQ 但打不开网页原因
- struts2之namespace
- Object-C--->Swift之(八)类和结构体
- ssh--write failed broken pipe
- nc (netcat)
- LeetCode36. Valid Sudoku
- 分布式视频编码关键技术及其发展趋势
- 认识SQL Server的虚影行(Ghost record)
- 依次读入数据,直到文件结束
- HDOJ 2056 Rectangles