没有为操作 <class> 定义结果和结果输入 [英] No result defined for action &lt;class&gt; and result input

查看:32
本文介绍了没有为操作 <class> 定义结果和结果输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的struts.xml:

<package name="ajax" extends="json-default" >
    <action name="loadcity"  method="loadcity" class="roseindia.action.user.RegisterUser" >
        <result  type="json" />
    </action>
</package>

当我调用 loadcity.action 时出现以下错误

When I am calling loadcity.action I am getting following error

No result defined for action roseindia.action.user.RegisterUser and result input

这是我的操作方法:

public String loadcity()
{ 
    country=request.getParameter("country");
  
    cityList=  dao.loadcity(country);
    return ActionSupport.SUCCESS;
}

推荐答案

首先,你的 srtuts.xml 文件没有完全定义应该在你的动作执行的响应上呈现的结果类型.result 标签在 Struts2 MVC 框架中扮演一个视图的角色.该操作负责执行业务逻辑.执行业务逻辑后的下一步是使用标签显示视图.在这里你可以做一件事

First of all your srtuts.xml file is not completely defining the result type which should be render on the response of you action execution .result tag plays the role of a view in the Struts2 MVC framework. The action is responsible for executing the business logic. The next step after executing the business logic is to display the view using the tag. Here you can do one thing

<package name="ajax" extends="json-default" >
    <action name="loadcity"  method="loadcity" class="roseindia.action.user.RegisterUser" >
        <result name="input" type="json" />
    </action>
</package>

这篇关于没有为操作 <class> 定义结果和结果输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆