Struts_ActionWildcard_通配符配置
使用通配符,将配置量降到最低
不过,一定要遵守“约定由于配置”的原则
struts2.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.configuration.xml.reload" value="true"/>
<constant name="struts.enable.DynamicMethodInvocation" value="true"/> <!-- namespace 必须 "/" 开头 -->
<package name="actions" namespace="/actions" extends="struts-default">
<action name="Student_add" class="com.bjsxt.struts2.action.TestAction" method="test">
<result>/test.jsp</result>
</action> <action name="Student*" class="com.bjsxt.struts2.action.StudentAction" method="{1}">
<result>/student{1}_success.jsp</result>
</action> <action name="*_*" class="com.bjsxt.struts2.action.{1}Action" method="{2}">
<result>/{1}_{2}_success.jsp</result>
</action>
</package> </struts>
StudentAction
package com.bjsxt.struts2.action;
import com.opensymphony.xwork2.ActionSupport;
public class StudentAction extends ActionSupport{
private static final long serialVersionUID = -8074753294134724983L;
public String delete(){
return SUCCESS;
}
public String add(){
return SUCCESS;
}
}
CourseAction
package com.bjsxt.struts2.action;
import com.opensymphony.xwork2.ActionSupport;
public class CourseAction extends ActionSupport{
private static final long serialVersionUID = -602409660355584918L;
public String add(){
return SUCCESS;
}
public String delete(){
return SUCCESS;
}
}
TeacherAction
package com.bjsxt.struts2.action;
import com.opensymphony.xwork2.ActionSupport;
public class TeacherAction extends ActionSupport{
private static final long serialVersionUID = -7951798648480925065L;
public String add(){
return SUCCESS;
}
public String delete(){
return SUCCESS;
}
}
TestAction
package com.bjsxt.struts2.action;
import com.opensymphony.xwork2.ActionSupport;
public class TestAction extends ActionSupport{
private static final long serialVersionUID = -8074753294134724983L;
public String test(){
return SUCCESS;
}
}
链接: http://pan.baidu.com/s/1miDgviS 密码: m24y
Struts_ActionWildcard_通配符配置的更多相关文章
- 01_6_Struts_ActionWildcard_通配符配置
01_6_Struts_ActionWildcard_通配符配置 1.Struts_ActionWildcard_通配符配置 1.1配置struts.xml文件 <package name=&q ...
- Struts2的通配符配置方式
Struts2的Action类很有意思,你可以使用3种方式来实现具体的Action类: 让你的Action类继承自ActionSupport类(项目中最常用这种方式,因为ActionSupport类中 ...
- 使用通配符配置action
建立struts2wildcard项目,此实例基本仿照前面前面第7点的实例改写而成.为了使用通配符,只需要改写配置文件即可.此实例未使用通配时的配置文件如下: <action name=&quo ...
- 配置typeAliasesPackage支持通配符包路径扫描
mybatis的xml文件中需要写类的全限定名,较繁琐,可以配置自动扫描包路径给类配置别名,两种配置方式. 方式一: mybatis-config.xml中配置 <typeAliases> ...
- Struts2-Action接受参数方式、method属性使用及通配符的配置
一.Action接受参数的方式 1.属性方式接收 首先编写一个用于上传参数的页面 <%@ page contentType="text/html;charset=UTF-8" ...
- 五 Action访问方法,method配置,通配符(常用),动态
1 通过method配置(有点low) 建立前端JSP:demo4.jsp <%@ page language="java" contentType="text/h ...
- Struts2中重定向和请求转发配置
struts2中默认跳转为dispatcher请求转发 只能往jsp转发,跳转action报404 重定向 设置为redirect ,可以是jsp也可以是action <!--同一个包下的act ...
- sphinx 配置sphinx.conf
sphinx的配置文件是在配置的时候最容易出错的了: 基本概念: source:数据源,数据是从什么地方来的. index:索引,当有数据源之后,从数据源处构建索引.索引实际上就是相当于一个字典检索. ...
- Struts2中通配符
1.Struts2中通配符可通过请求的url路径来确定包.类.方法.返回值名. 如 <action name="*_*_*_*" class="cn.javass. ...
随机推荐
- 3.Best Time to Buy and Sell Stock(买卖股票)
Level: Easy 题目描述: Say you have an array for which the ith element is the price of a given stock ...
- [PowerShell] check PowerShell Version
如果你已经开始在日常的工作中大量使用PowerShell自动化重复工作.建议你使用3.0以上的版本. 可以使用如下命令检测你的PS版本 如需要安装PowerShell,可以参看https://tech ...
- day35 数据库的初步认识
一. 数据库的由来分类 1. 数据库的概念 百度定义: 数据库,简而言之可视为电子化的文件柜——存储电子文件的处所,用户可以对文件中的数据运行新增.截取.更新.删除等操作. 所谓“数据库”系 ...
- wireshark开发环境搭建
自己完成了wireshark开发环境的搭建,主要参考资料是wireshark的官方developer-guide.pdf,网址:https://www.wireshark.org/docs/. 现把搭 ...
- Clover笔记
1. Clover传参 a. jobflow传到子graph(GraphParameters): 设值: 用全局GraphParameters传递,在ExecuteGraph中的output mapp ...
- [2019BUAA软工]第一次团队作业
Team V1 团队启动 BUAA Team V1 于2019年3月正式成立,将开始为期四个月的合作. 队员介绍 Name Summary Sefie wxmwy V1-bug制造公司资深工程师精 ...
- 经典网络LeNet5看卷积神经网络各层的维度变化
本文介绍以下几个CNN经典模型:Lenet(1986年).Alexnet(2012年).GoogleNet(2014年).VGG(2014年).Deep Residual Learning(2015年 ...
- Should I buy Auro OtoSys IM600 or Obdstar X300 DP?
Auro OtoSys IM600 and Obdstar X300 DP – What’s the difference & Which better? This is for those ...
- uva 442
#include<iostream>#include<stack>#include<map>using namespace std;struct node{ int ...
- thinkPHP5.0分页传参
分页函数paginate(),主要参数有:list_rows每页数量.page当前页.path URL路径.query URL额外参数.fragment URL锚点.type分页l类型 public ...