没有为操作定义结果,也没有为验证输入结果
这是我
<struts>
<include file="example.xml"/>
<constant name="struts.devMode" value="true" />
<package name="register" namespace="/register" extends="struts-default,json-default">
<action name="Registration" class="example.Registration">
<result name="success">/SucessPage.jsp</result>
<result name="input">/UserData.jsp</result>
</action>
<action name="validateEmailValue" method="validateEmailValue"
class="example.Registration">
<result type="json"/>
</action>
</package>
</struts>
在 jsp 页面中的
<s:form action="http://localhost:8080/MyRegistrationProject/register/Registration"
name="data" validate="true">
struts.xml ,它验证数据,但在我的操作类中有 do 方法执行和 validateEmailValue
我已经使用 getjson 进行 ajax 调用
$.getJSON("http://localhost:8080/MyRegistrationProject/register/validateEmailValue",
{ email:emailId },
function(data) { alert("success") }
);
当我调用 validateEmailValue 时,它会给出以下错误
No result defined for action example.Registration and result input
Any Insight ?谢谢
This is my struts.xml
<struts>
<include file="example.xml"/>
<constant name="struts.devMode" value="true" />
<package name="register" namespace="/register" extends="struts-default,json-default">
<action name="Registration" class="example.Registration">
<result name="success">/SucessPage.jsp</result>
<result name="input">/UserData.jsp</result>
</action>
<action name="validateEmailValue" method="validateEmailValue"
class="example.Registration">
<result type="json"/>
</action>
</package>
</struts>
in jsp page
<s:form action="http://localhost:8080/MyRegistrationProject/register/Registration"
name="data" validate="true">
it validate data but in my action class there are do method execute and validateEmailValue
I have make ajax call using getjson
$.getJSON("http://localhost:8080/MyRegistrationProject/register/validateEmailValue",
{ email:emailId },
function(data) { alert("success") }
);
When I make call for validateEmailValue it gives following error
No result defined for action example.Registration and result input
Any Insight? Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信您在操作类
example.Registration
中实现了validate()
对吗?即使您指定在操作
validateEmailValue
上调用方法validateEmailValue()
,它也会首先运行validate()
并检查验证是否成功,如果验证失败,会将页面转发到INPUT
结果。由于您的
validateEmailValue
操作没有声明INPUT
结果,系统会抛出您看到的错误。尝试将
INPUT
结果添加到您的validateEmailValue
操作中并查看显示的内容。I believe you implemented
validate()
in your action classexample.Registration
right?Even though you specified to call the method
validateEmailValue()
on your actionvalidateEmailValue
, it will first runvalidate()
and check if the validation succeed, and will forward the page toINPUT
result if validation failed.Since your
validateEmailValue
action do not have aINPUT
result declared, system throw the error you saw.Try adding the
INPUT
result to yourvalidateEmailValue
action and see what is shown.