今天在编程的时候,我遇到了No result defined for action and result input的错误,这个错误想必大家都有遇到过吧,我今天发了很长时间弄这个错误,我以为我的Action函数出错了想调试,但是程序就是不进入断点,上网查资料,有的说路径错误啦,然后我找我的路径错误,搞了半天还是没发现有路径问题。然后我给我的属性的get方法都弄上了断点,我发现了问题,现在跟大家分享。
这个错误就是说没有为返回的input定义,可是有时候我们不一定要这个鬼东西,然而在Action中出错的话,默认就返回了这个input了,这时,我们在struts的<result>中定义的话,就出现No result defined for action and result input的错误了。
引起这个错误的原因是很多的,路径错误也是其中的一种,我这里的问题是,我的页面上的类型和我定义的属性的类型不一致,我的属性是int型的,但是在页面上输出的时候加了一个逗号,用了分割千位的,结果就出现了这个问题了。

这个问题好像在strtus2.1以上版本才出现, 这个问题的上面的解决方案已经把原因说的差不多了,在实际应用中,我估计大部分情况应该都是在action里面定义了int或者别的什么类型的变量,然后指望struts的自动填装把post来的数据转换,这时容易出现转换失败,从而导致了这个错误,所以查这个错误,可以利用ff的httpfox来查看实际post的参数是什么,然后和action中对应的属性对比,看那个会出现转换错误。

淡然另一种就是上面说的在所有的set 中加入断点,总能看到是哪个方法执行失败的。

另外还有种就是页面提交了同一个名字的参数多个,比如

写道
username 123
username 123
permissions 123
info 31234

页面冲提交了了两个username ,而我的后台却只写了一个String username,这样同样会出错,这个是利用httpfox看的,

其实最好的是action中的和post相对应属性都设置成为String类型,省事,也不会再出现这个错误了,然后在execute中执行转换。这样也方便差错

No result defined for action and result input的更多相关文章

  1. [Struts2] No result defined for action ... and result input &amp; Invalid field value for field ...

    "No result defined for action ... and result input"错误一般发生在Struts2的拦截器拦截时遇到了问题时.Struts2会将跳转 ...

  2. s2h-HTTP Status 404 - No result defined for action and result input错误解决

    今天做个小项目,用的是ssh,结果在运行的时候出现HTTP Status 404 - No result defined for action and result input的错误. 首先认真检查所 ...

  3. Struts2问题,已解决No result defined for action and result input

    struts2.1.8 必须在struts.xml中配置namespace属性 如果你在2.0中一切OK,但是在2.1中确出现了No result defined for action的异常,就是在因 ...

  4. SSH整合报错:No result defined for action and result input

    目前发现这个问题主要是在Action中的execute返回值时,没有对应的result name而引起的.很有可能是由于程序执行中出错了,但是对 应的Action中没有添加 input的result  ...

  5. HTTP Status 404 - No result defined for action com.hebky.oa.classEntity.action.EntitysAction and result input

    在开发中总遇到这个问题,No result defined for action:原因:Action中的属性值为空的时候,Struts2的默认拦截器会报错,但是又找不到input的Result,不能够 ...

  6. no result defined for action

    1.no result defined for action .......and result input    或者 no result defined for action .......and ...

  7. SSH配置struts校验发生No result defined for action actions.AdminLoginAction and result input

    配置struts校验发生No result defined for action actions.AdminLoginAction and result input,但是登录,success.jsp, ...

  8. No result defined for action com.nynt.action.ManageAction and result input问题

    No result defined for action com.nynt.action.ManageAction and result input 问题原因: 1). 在action类中定义的一个r ...

  9. Struts2报错:No result defined for action xxx and result input

    case如下: 1. 后台程序要升级, 修改了一些功能,但是没有修改或者添加action的参数. 2. 数据库需要升级,执行了一些sql,修改过action的值. 3. 当修改某个已经存在的记录,然后 ...

随机推荐

  1. 【MVC】使用FormCollection获取Form表单数据

    public ActionResult Create(FormCollection form) { string name = form["name"]; //姓名 string ...

  2. Android应用安全解决方案

    Apk安全解决方案 背景 公司为政府做的App开发完了,需要上一些手段保证安全.这样客户才放心嘛. 防止第三方反编译篡改应用,防止数据隐私泄露,防止二次打包欺骗用户. 目录 Apk安全解决方案 背景 ...

  3. .Net Core IFormFile 始终为空的问题

    之前获取上传文件都是使用Request.Form.Files获取,直到这次改成定义形参 IFormFile时才遇到这个问题. // POST api/values [HttpPost] public ...

  4. C# PowerPoint操作的基本用法。

    代码using System;using System.Collections.Generic;using System.Linq;using System.Text;using OFFICECORE ...

  5. 【cocos2d-x 手游研发小技巧(5)获取网络图片缓存并展示】

    今天是年前最后一天上班了,最后一天上班,祝大家马上有各种东西,最后一天也给写一点干货,就是获取网络图片: 经过自己简单封装了一下,实现了获取网络图片,按照比例展示出来,实现方法是cocos2dx - ...

  6. WebService-php- 2(17)

    wsdl实例 <?xml version ='1.0' encoding ='UTF-8' ?> <definitions targetNamespace='http://local ...

  7. 【OCP题库-12c】最新CUUG OCP 071考试题库(72题)

    72.View the exhibit for the structure of the STUDENTand FACULTYtables. STUDENT Name Null? Type ----- ...

  8. lucene索引的更新和删除

    索引的删除: IndexReader和IndexWriter都由删除索引的功能,但这两者是有区别的, 使用IndexReader删除索引时,索引会马上被删除,其有两种方法,可以删除索引deleteDo ...

  9. Elasticsearch NEST – Examples for mapping between Query and C#

    Elasticsearch NEST – Examples for mapping between Query and C# During my training with Elasticsearch ...

  10. IECapt、CutyCapt 生成网页快照

    IECapt.CutyCapt  生成网页快照 http://iecapt.sourceforge.net/ http://cutycapt.sourceforge.net/ 1.以管理员身份 运行c ...