开发者

No result defined for action and result input for validation

开发者 https://www.devze.com 2023-04-13 03:10 出处:网络
This is my struts.xml <struts> <include file=\"example.xml\"/> <constant name=\"struts.devMode\" value=\"true\" />

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开发者_如何学Python },
    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


I believe you implemented validate() in your action class example.Registration right?

Even though you specified to call the method validateEmailValue() on your action validateEmailValue, it will first run validate() and check if the validation succeed, and will forward the page to INPUT result if validation failed.

Since your validateEmailValue action do not have a INPUT result declared, system throw the error you saw.

Try adding the INPUT result to your validateEmailValue action and see what is shown.

<result name="input" type="json"/>
0

精彩评论

暂无评论...
验证码 换一张
取 消