在前一篇文章的基础上,修改一部分即可(在此只是简单介绍)

struts.xml页面

在原来的基础之上

action的name="*_*"  class="包名.{1}" method="{2}"

 <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <!-- 国际化 -->
<constant name="struts.custom.i18n.resources" value="zr"></constant> <!-- user表的通配符增删改查 -->
<package name="aa" namespace="/user" extends="struts-default">
<action name="*_*" class="com.zr.{1}" method="{2}">
<result name="show">/show.jsp</result>
<result name="add" type="redirectAction">Struts2Text_showstuent?ye=1</result>
<result name="deletee" type="redirectAction">Struts2Text_showstuent?ye=1</result>
<result name="toupdate">/update.jsp</result>
<result name="update" type="redirectAction">Struts2Text_showstuent?ye=1</result>
</action>
</package> <!-- class10表的通配符增删改查 -->
<package name="bb" namespace="/class" extends="struts-default">
<action name="*_*" class="com.zr.{1}" method="{2}">
<result name="show">/Classshow.jsp</result>
<result name="add" type="redirectAction">ClassStruts2Text_showstuent?ye=1</result>
<result name="deletee" type="redirectAction">ClassStruts2Text_showstuent?ye=1</result>
<result name="toupdate">/Classupdate.jsp</result>
<result name="update" type="redirectAction">ClassStruts2Text_showstuent?ye=1</result>
</action>
</package> </struts>

add.jsp页面

将原来的

<form action="user/add.action" >   改为

<form action="user/Struts2Text_add" >

 <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
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>My JSP 'add.jsp' starting page</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">
--> <script type="text/javascript" src="layer/layer.js"></script>
<script type="text/javascript">
function add(a){
a.submit();
var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
parent.ReloadData();
parent.layer.close(index);
} </script> </head> <body>
<form action="user/Struts2Text_add" >
<input type="hidden" name="id">
<input type="hidden" name="method" value="add">
<input type="text" name="username" placeholder=" 请输入姓名"><br/>
<input type="text" name="password" placeholder=" 请输入密码"><br/>
<input type="button" onclick="javascript:add(this.form)" value="确定添加"><br/>
</form>
</body>
</html>

index.jsp页面

对38以及39行代码进行修改

第二行为引入struts标签库   <s:  >  </s:  >

30-39行代码均有国际化的体现  也是与之前代码相比较修改的地方

 <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%
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>My JSP 'index.jsp' starting page</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">
-->
<STYLE type="text/css">
a{
text-decoration: none;
color: black;
}
</STYLE>
</head>
<body>
<s:text name="userName"></s:text> <input type="text" placeholder="请输入用户名"><br/>
<s:text name="password"></s:text> <input type="text" placeholder="请输入密码"><br/>
<s:text name="welcomeInfo">
<s:param>郭艺华</s:param>
<s:param>大哥</s:param>
</s:text>
<button> <s:text name="login"></s:text></button><br/>
………………………………………………………………………………………………………………………………………………………………………………………………………<br/>
<a href="user/Struts2Text_showstuent?ye=1"><s:text name="user"></s:text></a><br/>
<a href="class/ClassStruts2Text_showstuent?ye=1"><s:text name="class"></s:text></a>
</body>
</html>

show.jsp页面

主要修改90-104行的分页代码   因为每一次翻页都需要用到show方法

也就是通配符的修改

 <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%
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>My JSP 'show.jsp' starting page</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">
-->
<script type="text/javascript" src="layer/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="layer/layer.js"></script>
<script type="text/javascript">
function func10() {
//iframe层
layer.open({
type: 2,
title: 'layer mobile页',
closeBtn: 1, //不显示关闭按钮
shadeClose: true,
shade: 0.8,
area: ['380px', '90%'],
content: 'add.jsp' //iframe的url
});
} function func11(id) {
//iframe层
layer.open({
type: 2,
title: 'layer mobile页',
closeBtn: 1, //不显示关闭按钮
shadeClose: true,
shade: 0.8,
area: ['380px', '90%'],
content: 'user/Struts2Text_toupdate?id='+id //iframe的url
});
} function ReloadData(){
window.location.reload();
}
</script> <style type="text/css">
a{
text-decoration: none;
color: black;
}
</style> </head> <body> <table border="1" bordercolor="gray" >
<tr>
<th>编号</th>
<th>姓名</th>
<th>密码</th>
<th>删除</th>
<th>修改</th>
</tr>
<c:forEach items="${list}" var="a">
<tr>
<td>${a.id}</td>
<td>${a.username}</td>
<td>${a.password}</td>
<td> <a href="user/Struts2Text_deletee?id=${a.id}">删除</a></td>
<td> <a href="javascript:func11(${a.id})">修改</a></td>
</tr>
</c:forEach>
</table> <c:if test="${param.ye>1}">
<a href="user/Struts2Text_showstuent?ye=1">首页</a>
</c:if>
<c:if test="${param.ye>1}">
<a href="user/Struts2Text_showstuent?ye=${param.ye-1}">上一页</a>
</c:if>
<c:forEach begin="1" end="${count}" varStatus="a">
<a href="user/Struts2Text_showstuent?ye=${a.index }">${a.index }</a>
</c:forEach>
<c:if test="${param.ye<count}">
<a href="user/Struts2Text_showstuent?ye=${param.ye+1}">下一页</a>
</c:if>
<c:if test="${param.ye<count}">
<a href="user/Struts2Text_showstuent?ye=${count}">尾页</a>
</c:if> <a href="javascript:func10()"> 添加 </a><br/> </body>
</html>

然后是代码笔记,在这里就不放源代码了

关于通配符的(未国际化之前)

(通配符加国际化)

index.jsp页面

struts.xml文件配置   国际化  只需要加一句话

以下为properties文件  命名规范根据语言缩写来

具体可以在Internet选项进行查看

properties文件打开样式

以上就是简单的通配符以及国际化的简单介绍

仅供参考

仅供记录

2017-08-1020:23:24

struts2增删改查---layer---iframe层---通配符---国际化的更多相关文章

  1. struts2增删改查---layer---iframe层

    在这里写一下struts2中的简单的增删改查 struts.xml中的配置 <?xml version="1.0" encoding="UTF-8" ?& ...

  2. struts2增删改查

    1.导入相关的依赖:struts.自定义标签库 配置pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xm ...

  3. Struts2增删改查(自己思路理解)

    1:查询所有: DAO层:把所有的信息都放到list集合中.然后返回. public List<Employee> getEmployees(){ return new ArrayList ...

  4. 反射实现增删改查(DAO层)——查询数据

    先贴出代码,后续补充自己的思路.配置文件.使用方式: /** * * 数据查询 * */ @Override public List<?> queryObject(List<Map& ...

  5. 反射实现增删改查(DAO层)——修改数据

    先贴出代码,后续补充自己的思路.配置文件.使用方式: /** * * 修改数据 * */ @Override public void updateObject(Object object, Strin ...

  6. 反射实现增删改查(DAO层)——删除数据

    先贴出代码,后续补充自己的思路.配置文件.使用方式: /** * * 删除数据 */ @Override public void deleteObject(List<Map<String, ...

  7. 反射实现增删改查(DAO层)——插入数据

    先贴出代码,后续补充自己的思路.配置文件.使用方式: /** * 插入数据 */ @Override public void addObject(Object object, String table ...

  8. 权限管理系统之LayUI实现页面增删改查和弹出层交互

    由于对LayUI框架不太熟悉,昨天抽空看了下LayUI的文档,今天在网上找了使用LayUI进行增删改查相关内容,自己照葫芦画了个瓢,画瓢部分不是很难,主要是下午遇到了一个弹出层的问题耗时比较久. 同一 ...

  9. Struts2+Spring+Hibernate实现员工管理增删改查功能(一)之ssh框架整合

    前言        转载请标明出处:http://www.cnblogs.com/smfx1314/p/7795837.html 本项目是我写的一个练习,目的是回顾ssh框架的整合以及使用.项目介绍: ...

随机推荐

  1. yii2 入口文件 提示syntax error, unexpected T_OBJECT_OPERATOR

    PHP Version 5.3.3 原因是php的安装版本太低

  2. linux服务器load的含义

    Linux的Load(系统负载),是一个让新手不太容易了解的概念.load的就是一定时间内计算机有多少个active_tasks,也就是说是计算机的任务执行队列的长度,cpu计算的队列. top/up ...

  3. zookeeer client 通信协议

    这里主要记录zookeeper client通信协议的.在官方的文档里没找到协议相关部分.这里是记录的协议是通过分析客户端代码得来的. 一.通信流程 客户端发起连接,发送握手包进行timeout协商, ...

  4. GitBash学习1

    昨晚学了一点GitBash,建立库,向库里添加文件,对比修改的内容等等. 自己做了以下总结 git mkdir <dirname> //建立文件 git cd <dirname> ...

  5. C++基础之引用与指针的区别与联系、常引用使用时应注意的问题

    什么是引用? 引用就是对变量起一个别名,而变量还是原来的变量,并没有重新定义一个变量.例如下面的例子:   #include<iostream> using namespace std; ...

  6. XML 新手入门基础知识

    XML 是可扩展标记语言(Extensible Markup Language)的缩写,其中的 标记(markup)是关键部分.您可以创建内容,然后使用限定标记标记它,从而使每个单词.短语或块成为可识 ...

  7. createjs 小游戏开发实战

    [转载请注明出处] 紧接着上一篇文章createjs入门:http://www.cnblogs.com/beidan/p/7055422.html 这里来一篇小游戏实战篇. 游戏整体思路实现 1. 实 ...

  8. 003.ASP.NET Core tutorials--【Asp.net core 教程】

    ASP.NET Core tutorials Asp.net core 教程 2016-10-14 1 分钟阅读时长 本文内容 1.Building web applications 构建web应用 ...

  9. voa 2015 / 4 / 19

      potentially – adv. capable of becoming real, a possibility tackle – v. to deal with a difficult pr ...

  10. C# Using的用法

    C#里面Using有两种用法: 1.作为指令. using+命名空间,导入其他命名空间中定义的类型,这样可以在程序中直接用命名空间中的类型,不必指定命名空间: 命名空间是.NET程序在逻辑上的组织结构 ...