关于struts2中的action跳action

问题描述

我要从user.xml跳到student.xml的action中,怎么写啊,package名儿为user和student,namespace都为 /。 我该怎么写? 问题补充:710022315yy 写道

解决方案

调用userAction 里使用<result type="chain">xxx.do</result>就可以了吧struts2里定义action可以配置上method参数的 也就是你要调用哪个函数,比如你的userAction里有个login方法<action name="user" class="userAction" method="login"> <result name="loginSuccess" type="chain">/getStudent.do</result> <action><action name="getStudent" class="studentAction" method="getAllStudent"> <result name="getAllStudent">/student/studentList.jsp</result></action>
解决方案二:
action类是这样的import com.opensymphony.xwork2.ActionSupport;public class UserAction extends ActionSupport { public String login(){ /// xxxxxxxx; return "loginSuccess"; }}
解决方案三:
我感觉直接在userAction 中写跳转,然后url填上studentAction的url就可以了。url就是你在xml里边配的哪个/xxx.do的应该,struts2是action,忘记了。

时间: 2024-08-01 11:33:57

关于struts2中的action跳action的相关文章

Struts2中通过url给Action传递参数,是否可以设定到对象内的变量?

问题描述 Action内对象为public class MyAction extends ActionSupport { private User user: public User getUser() { return this.user } public void setUser(User user) { this.user = user; } // 其他代码省略 ..................... } User:public class User {private String n

Struts2中的&amp;lt;s:action&amp;gt;标签

一.基本概念 action标签允许开发者在JSP页面中直接调用action,该标签有以下属性: 1 executeResult 可选属性,为一个Boolean类型值,用来指定是否显示action的执行结果,默认值为false,即不显示. 2 id 可选属性,用来引用该action的标识. 3 name 必填属性,用来指定该action的实现类位置. 4 namespace 可选属性,用来指定该标签调用的action所在的命名空间. 5 ignoreContextParams 可选属性,用来指定该

struts2中action和field级别错误处理

在struts2中,一般的action都继承ActionSupport这个类,可以重写public void validate()来进行数据校验,对应提示信息来说一般有两个比较常用的方法就是this.addFieldError("field name","error message"); 和 this.addActionError("error message");两个方法. 由于在ActionSupport这个类实现了ValidationAwa

bae中action跳转jsp出现异常

问题描述 bae中action跳转jsp出现异常 我的那个项目在本机上测试时action跳转jsp可以跳转, 在bae上面就出现 HTTP ERROR 404 Problem accessing /stuinfo.action. Reason: result 'null' not found Powered by Jetty:// 我的struts2配置文件为 /success.jsp

struts2 action jsp-Struts2的action跳转问题

问题描述 Struts2的action跳转问题 在浏览器请求add的action,提交一个简单表单. 要实现的功能:在进行添加功能之后,页面自动跳转到展示界面显示数据. 遇到的问题:现在add执行之后成功保存数据,并成功执行到list的方法并返回SUCCESS,但是浏览器的页面并没有跳转到数据显示页面. 解决方案 struts2中action 跳转的传值问题struts2中action 跳转的传值问题struts2中action 跳转的传值问题 解决方案二: 检查一下action中add方法后的

Struts2中Action中是否需要实现Execute方法_java

今天有朋友问我Struts2中Action必须实现execute方法吗?顺利的回答出来了. 其实分两种情况: 1)如果你的Action类是继承自ActionSupport或是BaseAction的话,确切的说是重写了execute方法,ActionSupport里的默认实现就是返回"success"视图.因此,你可以不实现execute方法,只要你的struts.xml里有"success"对应的result即可. <action name="doR

Struts2教程6:在Action类中获得HttpServletResponse对象的四种方法

在struts1.x Action类的execute方法中,有四个参数,其中两个就是response和request.而在Struts2中,并没有任何参数,因此,就不能简单地从execute方法获得HttpServletResponse或HttpServletRequest对象了. 但在Struts2 Action类中仍然有很多方法可以获得这些对象.下面就列出四种获得这些对象的方法. [方法1]使用Struts2 Aware拦截器 这种方法需要Action类实现相应的拦截器接口.如我们要获得Ht

Struts2中Action接收参数的方法

Struts2中Action接收参数的方法主要有以下三种: 1.使用Action的属性接收参数:     a.定义:在Action类中定义属性,创建get和set方法:     b.接收:通过属性接收参数,如:userName:     c.发送:使用属性名传递参数,如:user1!add?userName=Magci: 2.使用DomainModel接收参数:     a.定义:定义Model类,在Action中定义Model类的对象(不需要new),创建该对象的get和set方法:    

web-关于在osgi插件开发中action 跳转

问题描述 关于在osgi插件开发中action 跳转 为什么我使用webwork在web项目下面写action可以执行相应的execute方法并且跳转到相应的页面,但是同样地代码在osgi插件开发中为什么就是无法跳转到result定义的相应的页面 解决方案 http://dollyn.iteye.com/blog/965375 解决方案二: Struts.xml 文件中需要继承 osgi-default,详细可访问:http://osgi.help 解决方案三: rcp(插件开发)Action的