Swapnil Sonawane
Swapnil Sonawane

Reputation: 1455

No result defined for action and result input for validation

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

Upvotes: 1

Views: 6790

Answers (1)

Quincy
Quincy

Reputation: 4433

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"/>

Upvotes: 1

Related Questions