关于初学者Could not find action or result :No result defined for action com.lyw.action.LoginAction and result success
解决如下:
将:<package name="struts2" extends="struts-default" >
<action name="login" class="com.lyw.action.LoginAction">
<result name="success">/result.jsp</result>
</action>
</package>
添加 namespace="/"就好了
<package name="struts2" extends="struts-default" namespace="/" >
<action name="login" class="com.lyw.action.LoginAction">
<result name="success">/result.jsp</result>
</action>
</package>
在struts1中是没有命名空间这个概念的,通过命名空间我们可以将所有的action配置划分为一个个逻辑单元,每个单元都有它自己的标识前缀。命名控件可以避免action命名的冲突。每个命名空间下有可以有一个叫做”help”的action,并且有着各自不同的实现,当然在同一个命名空间下最好是不要出现两个名字一样的action。当命名空间的前缀出现在浏览器的URI中时,标签会意识到命名空间,因此我们不必将命名空间嵌套在表单和链接中。
默认的命名空间是空字符串””,也就是不设置namespace属性时候的命名空间。我们在匹配一个action的时候,先到它指定的命名空间中去找,如果没有再到这个默认的命名空间中去找。Struts2还支持根命名空间(“/”),当一个request直接请求context path下面的资源时,struts2会首先到跟命名空间下去寻找匹配的action,例如请求是http://server/myapp/bar.action,那么我们首先会去”/”命名空间下去寻找这个action.
转载自博客园。
关于初学者Could not find action or result :No result defined for action com.lyw.action.LoginAction and result success的更多相关文章
- No result defined for action action.LoginAction and result success 问题解决
转自:https://blog.csdn.net/dongzhout/article/details/43699699 搭建好SSH2框架,写一个简单的登陆功能,提交表单的时候遇到这个问题: 配置文件 ...
- Struts2框架action路径问题心得----》页面url请求怎么找action
Struts2 页面url请求怎么找action Struts2 页面url请求如何找action 1.我们使用最原始的方法去查找action,不同注解. struts.xml文件先配置 <!- ...
- HTTP Status 404 - No result defined for action com.csdhsm.struts.action.LoginAction and result error
智商拙计的问题,没有找到为类LoginAction和error找到定义,然后重新去struts.xml去看,我类个去,我居然把result写成了ERROR <result name=" ...
- Struts2:No result defined for action com.yibai.user.action.LoginAction and result input
转自:https://zhidao.baidu.com/question/133574016.html 1 String 里面有5个static 常量分别是: ERROR INPUT LOGIN NO ...
- 菜单ACTION控制栏位字段编辑,点击菜单ACTION才能编辑指定的栏位
范例(axmt500): 目的,控制新增的栏位(价格清单2),需点击菜单栏“修改价格清单2”才能对相应的栏位进行编辑修改,并记录修改人.日期: 1)在规格上增加新ACTION——action_modi ...
- Struts 2.x No result defined for action 异常
这是我跑struts2的第一个例子,跑的也够郁闷的,这个问题烦了我几个钟... 2011-5-10 10:10:17 com.opensymphony.xwork2.util.logging.co ...
- 【Struts2学习笔记(1)】Struts2中Action名称的搜索顺序和多个Action共享一个视图--全局result配置
一.Action名称的搜索顺序 1.获得请求路径的URI,比如url是:http://server/struts2/path1/path2/path3/test.action 2.首先寻找namesp ...
- 【Struts2学习笔记(2)】Action默认值和配置Action于result各种转发类型
一.Action缺省配置值 <span style="font-size:18px;"><package name="itcast" name ...
- Struts2-2.了解struts.xml>package>action>result的name属性
result决定跳转到哪个视图(jsp),可以预设值有多个. <?xml version="1.0" encoding="UTF-8" ?> < ...
随机推荐
- NET中的Memcached.ClientLibrary使用详解
memcached在windows下的下载与安装 下载地址:http://pan.baidu.com/s/1yVILw 提取密码:5gx9 官方网站:http://memcached.or ...
- Thread.join简单介绍
百度了一下,终于明白了.这个解释最简单: 前提:join()方法肯定是被某个线程调用的. A线程正在执行,突然执行的时候碰到了B.join(), 那么,A线程就必须要等到B线程执行完之后才能执行. ...
- 使用composer管理php项目
composer global require "fxp/composer-asset-plugin:~1.1.1" composer create-project --prefe ...
- IOC框架整体介绍
1.Castle Windsor 2.Autofac 3.Unity 4.Spring.NET 5.StructureMap 6.Ninject
- WindowsFormsHost使用问题
WindowsFormsHost使用问题 WPF WindowsFormsHost 类 允许在 WPF 页面上承载 Windows Forms控件的元素. 命名空间: System.Windows. ...
- android 代码设置progressBar 颜色
void test() { LinearLayout linearLayout = new LinearLayout(this); ProgressBar progressBar = new Prog ...
- sed字符串替换
把drivers目录下的所有pr_log替换成:pr_snd sed -i "s/pr_log/pr_snd/g" `grep pr_log -rl drivers/` 把driv ...
- 支持ASP.NET MVC
ASP.NET MVC能很方便在后台返回JSON数据,所以与MiniUI进行数据交互非常简单. 1)后台处理: 在MVC控制器中,可以通过方法参数接收数据,也可以通过Request接收更复杂的数据对象 ...
- ubuntu 14.04 compiz的ALT + TAB切换程序
安装完ubuntu,发现不能使用ALT + TAB切换应用程序,翻遍所有百度结果,没有可行,都是拷这个拷那个...真实无语...FQgoogle,看的第一个就完美解决.记录下来,方便国人少走弯路. 首 ...
- Create a geoprocessing tool to buffer a layer and retrieve messages____sync
using System.Drawing; using System.Text; using System.Windows.Forms; using System.Runtime.InteropSer ...