result决定跳转到哪个视图(jsp),可以预设值有多个。

<?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>
<package name="itcast" namespace="/test" extends="struts-default">
<action name="helloword" class="cn.itcast.action.HelloWordAction" method="execute">
<result name="success">/WEB-INF/page/hello.jsp</result>
<result name="success2">/WEB-INF/page/hello2.jsp</result>
</action>
<!-- 如果要访问该action,需要在浏览器输入:package的namespace+action的name -->
</package>
</struts>

但是最终决定跳转的,还是程序决定的

package cn.itcast.action;

public class HelloWordAction {
private String msg;
public String getMessage() {return msg;} public String execute(){
msg="Struts应用";
return "success2";//找到对应的action>result的name="success2"的视图地址
}
}

对应的视图有

访问测试   http://localhost:8080/Struts2/test/helloword

Struts2-2.了解struts.xml>package>action>result的name属性的更多相关文章

  1. struts2配置文件的加载顺序以及 struts.xml package 的配置说明

    查看StrutsPrepareAndExecuteFilter:(核心过滤器)两个功能 :预处理 和 执行 在预处理功能中 init 方法中会有加载配置文件的代码: dispatcher.init() ...

  2. 转载 Struts2的配置 struts.xml Action详解

    在学习struts的时候,我们一定要掌握struts2的工作原理.只有当我们明确了在struts2框架的内部架构的实现过程,在配置整个struts 的框架时,可以很好的进行逻辑上的配置.接下来我就先简 ...

  3. 一 SSH整合:Spring整合Struts2的两种方式,struts.xml管理Action&Bean管理Action

    SSH回顾 1 引入jar包 Struts2的jar包 D:\Struts2\struts-2.3.35\apps\struts2-blank\WEB-INF\lib  开发基本包 Struts2有一 ...

  4. struts2学习笔记--struts.xml配置文件详解

    这一节主要讲解struts2里面的struts.xml的常用标签及作用: 解决乱码问题 <constant name="struts.i18n.encoding" value ...

  5. 在Struts.xml中的result元素指的是:指定动作类的动作方法执行完后的结果视图.

    result结果集 上一篇文章主要讲Struts2框架(4)---Action类访问servlet这篇主要讲result结果集 在Struts.xml中的result元素指的是:指定动作类的动作方法执 ...

  6. 【学习笔记】Struts2之配置文件struts.xml

    在默认情况下,Struts2只自动加载类加载路径下的struts.xml.default-struts.xml和struts-plugin.xml三类文件.但是随着应用规模的增大,系统中Action数 ...

  7. struts2.0中struts.xml配置文件详解

    先来展示一个配置文件 <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration ...

  8. Struts2-3.struts.xml的action可以简写

    如果只是跳转到某个页面的话,可以这样写 <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE s ...

  9. 1-1 struts2 基本配置 struts.xml配置文件详解

    详见http://www.cnblogs.com/dooor/p/5323716.html 一. struts2工作原理(网友总结,千遍一律) 1 客户端初始化一个指向Servlet容器(例如Tomc ...

随机推荐

  1. 设计模式(二)单例模式Singleton(创建型)

    几乎所有面向对象的程序中,总有一些类的对象需要是唯一的,例如,通过数据库句柄到数据库的连接是独占的.您希望在应用程序中共享数据库句柄,因为在保持连接打开或关闭时,它是一种开销.再如大家最经常用的IM, ...

  2. sequekize

    关于sequelize的准备工作这里不再赘述. 一.引入sequelize模块 var Sequelize = require('sequelize'); 二.连接数据库 var sequelize  ...

  3. 最全js 放大镜效果

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  4. 【angular】angular实现简单的tab切换

    html: <div class="list-group" ng-repeat="tab in menuList"> <a href=&quo ...

  5. USACO 3.3 TEXT Eulerian Tour中的Cows on Parade一点理解

    Cows on Parade Farmer John has two types of cows: black Angus and white Jerseys. While marching 19 o ...

  6. 编译 ORB_SLAM2 (一)

    之前有记录关于ORB_SLAM的第一个版本的编译,每次就是要编译程序,都会遇到很多问题,并不是所谓的按照教程来就一定能编译成功,所以这一次编译也遇到了很多问题.百度的时候也看到网上有很多相似的问题,但 ...

  7. extjs 6.2 helloworld

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  8. SURF 特征法

    public static void FindMatch(Mat modelImage, Mat observedImage, out long matchTime, out VectorOfKeyP ...

  9. Github命令详解

    Git bash: ***创建本地版本库: $ cd d: $ mkdir git $ cd git $ mkdir test $ git init   //初始化本地库 ***创建文件并添加到版本库 ...

  10. Qt实现悬浮窗效果

    当鼠标移动到头像控件时,显示悬浮窗,当鼠标离开时,悬浮窗隐藏.   1.控件选择 悬浮窗可以从QDialog派生,并将窗口的属性设置为无边框 this->setWindowFlags(this- ...