-
java问题action如何调用其它action的方法 action可否调用其它action的方法 ssh
2018-06-18 17:50:12你可以直接在那个action里面 如 <result name="success">/index.jsp</action> 可以那他改成 <result name="success" type="redirect"&...你可以直接在那个action里面
如<result name="success">/index.jsp</action>
可以那他改成
<result name="success" type="redirect">*****.action</action>
我的例子:
<action name="index" class="struts2.action.GainInformation" > <result name="gain1_success" >/index.jsp</result> <result name="gain1_fail">/index.jsp</result> </action>
<action name="login" class="struts2.action.LoginAction"> <result name="success" type="redirect">index.action</result> <!-- <result name="login_success">/index.jsp</result> --> <result name="login_fail">/login.jsp</result> </action>
-
J2EE进阶(三)struts2 <s:action>标签的用法
2016-07-16 12:16:16J2EE进阶(三)struts2 标签的用法前言 使用action标签,可以允许在jsp页面中直接调用Action,(类似AJAX页面调用)在调用Action时候,可以指定需要被调用的Action的name和namespace.如果指定了executeResult参数的属性值为...J2EE进阶(三)struts2 <s:action>标签的用法
前言
使用action标签,可以允许在jsp页面中直接调用Action,(类似AJAX页面调用)在调用Action时候,可以指定需要被调用的Action的name和namespace.如果指定了executeResult参数的属性值为true,该标签会把Action的处理结果(视图资源)包含到本页面中. 使用action标签指定属性有:
id: 可选属性,作为该Action的引用ID
name:必选属性,指定调用Action
namespace:可选属性,指定该标签调用Action所属namespace
executeResult:可选属性,指定是否将Action的处理结果包含到本页面中.默认值为false,不包含.
ignoreContextParam:可选参数,指定该页面的请求参数是否需要传入调用的Action中,默认值是false,即传入参数.
<s:action name="login" executeResult="true" namespace="/"></s:action>
传递参数
<s:action name="actinName" executeResult="true" namespace="/">
<s:param name="currentPage" value="传递的值"></s:param>
</s:action>
<s:param ></s:param>是以request方式的值的,而不是以参数传值
所以request.getParameter("")会获取不到值
通过request.getAttribute("")方式可以获取
另外:使用<s:param ></s:param> value指代的是action定义的对象的名称,而不是一个值。和 <s:textfield>中的name是一个意思,所以要要传递字符串的不能把值写value中而应该写成:<s:param >写到这里</s:param>。
美文美图
-
<form action=''" method=post>action是什么意思?
2014-04-16 07:58:59form action=''" method=post>action是什么意思? <url-pattern>/LoginServlet</url-pattern>和<url-pattern>/*</url-pattern>有什么区别? 假如我有个请求被拦截了是不是就不会去执行... -
struts2 action重定向action
2014-08-13 15:12:50一共有三种方式redirect,redirect-action,chain 区别如下 1 redirect:action处理完后重定向到一个视图资源(如:jsp页面),请求参数全部丢失,action处理结果也全部丢失。 2 redirect-action:action处理完后...一共有三种方式redirect,redirect-action,chain
区别如下
1 redirect:action处理完后重定向到一个视图资源(如:jsp页面),请求参数全部丢失,action处理结果也全部丢失。
2 redirect-action:action处理完后重定向到一个action,请求参数全部丢失,action处理结果也全部丢失。
3 chain:action处理完后转发到一个action,请求参数全部丢失,action处理结果不会丢失。今天碰到的bug显示提示另一个action错误,删掉action后提示
There is no Action mapped for namespace / and action name
最后才确定redirect-action,chain两种方式路径里不能带.action
-
关于No result defined for action org.action.StrutsAction and result success
2013-10-08 10:55:04最近在做struts2的时候,老是碰见这样一个令人吐血的bug。...No result defined for action org.action.StrutsAction and result success at com.opensymphony.xwork2.DefaultActionInvocation...最近在做struts2的时候,老是碰见这样一个令人吐血的bug。
警告: Could not find action or result No result defined for action org.action.StrutsAction and result success at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:375) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:277) at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263) at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:142) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:166) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485) at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1852) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619)
在网上寻了很久,查了很多资料,终于找到了自己错误的原因。实际上都是一个边边角角的错误,或是系统不兼容的错误。
我的struts.xml的配置文件
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd"> <struts> <package name="default" extends="struts-default"> <action name="struts" class="org.action.StrutsAction"> <result name="success">/welcome.jsp</result> <result name="error">/hello.jsp</result> </action> </package> </struts>
还有hello.jsp和welcome.jsp文件<%@ page language="java" pageEncoding="utf-8"%> <!-- 导入标签开发能力 --> <%@ taglib uri="/struts-tags" prefix="s"%> <html> <head> <title>struts 2应用</title> </head> <body> <s:form action="struts.action" method="post"> <s:textfield name="name" label="请输入姓名"></s:textfield> <s:submit value="提交"></s:submit> </s:form> </body> </html>
<%@ page language="java" pageEncoding="UTF-8"%> <%@ taglib uri="/struts-tags" prefix="s" %> <html> <head> <title>struts 2应用</title> </head> <body> hello <s:property value="#request.name"/>! </body> </html>
最后就是StrutsAction文件package org.action; import java.util.Map; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; public class StrutsAction extends ActionSupport{ private String name; public String getName() { return name; } public String execute() throws Exception{ if(!name.equals("HelloWorld")){ Map request1=(Map)ActionContext.getContext().get("request"); request1.put("name",getName()); return SUCCESS; }else{ return ERROR; } } }
出现错误后,笔者对其中的jar包以及配置文件进行了详细的检查问题就出现在了struts.xml这个文件上,网上说当在struts.xml文件中的action的 name属性要选择其他的字符串定义,不要占用了struts2的关键字-------“struts”。当然为什么会这样,笔者也不大了解,可能是规定吧。
可改了之后,问题依然存在,后来在网上发现了原因,就是jsp中的form表单中的代码,确认form表单的action和struts.xml中的action相对应。就是form中的action=“abc”,则struts.xml中<action name="abc">,这两者要相同。
改正之后,程序终于可能正确的运行了。
--------------------------------------------------------------------------------------------------------------------------------------------------------------
-
Android Action
2016-05-05 11:49:22BroadcastReceiver_ACTION: ACTION_AIRPLANE_MODE_CHANGED "android.intent.action.AIRPLANE_MODE" --用户切换飞行模式 ACTION_BATTERY_CHANGED "android.intent.action.BATTERY_CHANGED" --这是一个粘性广播包含... -
Unity(十一) Action UnityAction与event UnityEvent
2018-07-20 14:57:07PS:最近看到有很多地方用到UnityAction和UnityEvent的地方,自己也刚刚学习,总结一下 Action 与event Action也是基于委托,并且无返回值。可带参数Action<T1,T2,T3,T4>。通常大家可以用在订阅... -
SOAP Action介绍
2019-11-26 16:02:00SOAP Action 据说SOAP Action header在SOAP 1.1规范中着实让不少开发者喝了一壶。真的有那么难理解么?我想这应该是因为SOAP有两种非常不同的使用方式,而SOAP Action主要是被用来支持其中应用较少的一种方式的... -
jquery 获取form action路径 设置form action 路径
2018-04-18 14:23:56获取From的action:$("#FormID)").attr("action");设置Form的action:$("#FormID)").attr("action",“you url”); -
Html.Action与Url.Action的区别
2018-03-21 10:20:27Url.Action返回的是指定控制器指定action的完整URL地址,不含<a>标签,例如:<%:Url.Action("SelectDetail","OutBox",new{letterid=m.LetterID}) ... -
UnityAction和System.Action引发的思考
2018-04-05 01:07:59今天突然发现UnityAction,这是什么,怎么和Action有着类似的功能?可是如果功能如果真的一致,那unity官方提供这个不是多此一举吗。 在google的帮助下我得到了答案。(百度真是垃圾) UnityAction和System.Action... -
android事件传递ACTION_DOWN、ACTION_MOVE、ACTION_UP的深入研究
2017-04-26 16:20:32对于事件的传递大概的流程,都比较清楚。这里主要探讨下事件流ACTION_DOWN、ACTION_UP、ACTION_MOVE不同部分的拦截会有什么样的影响。 -
IntelliJ Save Action
2018-09-23 20:42:51在Team开发项目中,都是多人维护一个项目。因此,保持良好的代码规范与风格很重要。 IntelliJ 默认是自动保存的,...Save Action就是一个。 安装简单: File -> Settings -> Plugins,搜索“Save actions... -
struts2中action向action之间传数据和action向jsp传数据理解
2015-11-14 09:43:371,在 Action中我们经常会从这个Action跳转到另一个Action中,这时我们就要用到redirect、redirect-action、chain, 其中redirect和redirect-action是重定向,相当于浏览器二次请求,之前的数据都会丢失,所有的... -
action函数详解(自定义action)
2016-04-14 16:56:16controller中自定义action: 1.添加路由 delete '/dsdfas/:id/fdas/:home_id' => “controller#action” 2.controller中定义该action的函数 3.方法一:查其路由路径 类似edit_manage_path的,然后, 则匹配上路由... -
asp.net mvc之Url.Action()用法详解
2016-12-29 16:37:38Url.Action()方法在asp.net mvc中也是比较常用的方法,其有8种重载方法,每一种重载方法的用法见下表。 Url.Action重载列表 名称 说明 示例 Action(String) 使用指定的操作名称生成操作方法的完全限定 URL @... -
Action 和Func
2018-10-25 17:40:42即Action Func Action Acition 属于无参无返回值的函数类型 Action< T>通过设置泛型,我们可以定义有多个参数, 无返回值的函数 当函数有多个重载的时候,系统会自动匹配 Action是没有返回值的 参数... -
action标签
2012-10-03 23:42:22action标签,使用action标签可以允许在jsp页面中直接调用Action,因为需要调用Action,所以指定需要被调用Action的那么及namespace。如果指定的executeResult参数属性是true,该标签还会把Action的处理接个包涵到本... -
Struts2_Action访问与Action方法调用
2016-05-16 09:36:27一、Action访问路径 Action的访问路径是由struts.xml文件中配置的Action所在包的命名空间,Action的名字和常struts.action.extension共同决定的 例如: /1.jsp /2.jsp -
vuex 中在一个action方法中调用另一个action方法
2019-03-08 10:06:11在另外一个 action 中也可以: actions: { // ... actionB ({ dispatch, commit }) { return dispatch('actionA').then(() => { commit('someOtherMutation') }) } } -
ROS学习笔记六:action-server/action-client
2018-03-19 12:08:07ROS学习笔记六:action-server/action-client 以下是最后一种通信机制action-server/action-client,尽管与service/client通信机制很像,它与service/client通信机制还是有很关键的不同点的: 那就是多对多的... -
android MotionEvent getAction,getActionMasked,getActionIndex区别
2017-03-20 14:18:31getAction,getActionMasked,getActionIndex区别 -
警告: Could not find action or result There is no Action mapped for namespace / and action name
2017-04-17 13:42:48在使用Struts框架时,为了使用验证码功能,加入了servlet,而Struts会截获所有请求,把servlet当成action,不能正常响应servlet的请求。 解决办法:在struts.xml文件加入 constant name="struts.action.extension" ... -
String action = request.getParameter("action");action老是为空
2014-04-10 06:52:30myeclipse环境搭建一个服务器,文件时ClassInfoServlet,debug时候String action = request.getParameter("action");这句action为空,不知道怎么解决。。。 package servlet; import java.io.IOException; ... -
android 中关于Phone的ACTION_CALL、ACTION_CALL_PRIVILEGED、ACTION_DIAL的区别
2015-11-30 11:13:17系统拨打电话可以调用action如下: ACTION_CALL(普通), ACTION_CALL_EMERGENCY (紧急电话), ACTION_CALL_PRIVILEGED(系统专属), 而普通应用要拨打电话只能调用ACTION_CALL。 ACTION_CALL 根据指定的数据... -
Struts2.5动态方法调用action和使用通配符访问action
2017-01-16 22:43:59当一个Action处理了多个控制逻辑的时候,可能需要使用这个Action中的不同方法来进行不同的处理,此时有两种方法可以选择。 1.动态方法调用Action。 这种方法,需要在struts.xml中对其进行支持: 当struts.xml中... -
GitHub Action开启自动化
2019-11-16 14:23:18这周突然发现公司项目的GitHub代码库多了一个Tab页,叫做GitHub Action。于是了解了一下,发现这就是大家期待已久的自动化功能。自动化不只是我们常说的CICD(持续集成和持续部署),通过定义一个yml文件我们可以... -
iOS进阶:【Target-Action设计模式】UIKit框架下点击或拖动事件的Target-Action设计模式
2020-08-15 09:49:14Target-Action,也叫“目标-动作”模式,即当某个事件发生的时候,调用特定对象的特定方法。“特定对象”就是Target,“特定方法”就是Action。 Target-Action模式主要包含两个部分: Target(对象):接收消息的... -
Ultimate Action
2013-07-19 17:34:51Ultimate Action 重拾ACM。 :) 可能的话,大家区域赛见 :) 届时本人将代表国科大参加比赛 :) 哇咔咔~ -
Struts2的动态调用Action方法和默认Action
2016-06-04 19:51:25方法名,即可以实现动态调用,而不需要为Action中的每个方法都在struts.xml进行action的配置。 注意:要把struts.enable.DynamicMethodInvocation的值为true,如 ,否则无法动态访问 Action.java import ...
-
(新)备战2021软考软件设计师学习教程培训套餐
-
最新EasyX库下载
-
JAVA面向对象设计基础
-
html个人简历表格制作
-
深入理解NIO与Epoll
-
浙大版《数据结构(第2版)》题目集习题2.5 两个有序链表序列的合并 (15分)
-
windows xp3 sam
-
单片机完全学习课程全五季套餐
-
如何实现Envoy 动态配置一个简单的控制平面
-
thinkphp5.1博客后台实战视频
-
linux下 如何安装开源软件 手把手教你源代码安装方式.zip
-
RabbitMQ消息中间件实战(附讲义和源码)
-
flutter插件调用APP页面、使用原生aar,framework库
-
分享一篇详解介绍Java中定时任务Timer、Spring Task、quartz
-
java中对象数组排序(java比较器,Comparable 或 Comparator)
-
数据结构算法实现(严蔚敏版配套实现程序)
-
【数据分析-随到随学】Python语法强化与数据处理
-
CentOS 7 安装PHP 5.4.16
-
【Jeecg】【代码生成】【VUE】-edit-接口调用-405错误
-
install_flash_player_ax_cn_34_0_0_92离线安装包