jones
jones

Reputation: 171

No result defined for action and result input

I am using Struts2

I get error as no result defines for action and result input

<action name="update" method="updatePhase" class="Project">
   <result name="updated">/Project.jsp</result>
</action>

My action is not passing to my java class.

Can anyone help me?

Upvotes: 17

Views: 89191

Answers (10)

codingangel
codingangel

Reputation: 37

The most common case is the presence of convention plugin. Look for that anything with a "convention" in it and remove that. A more detailed description will follow soon.

Upvotes: 2

Ashish
Ashish

Reputation: 31

Suppose you are coming from x.jsp.

Some times when you put validation annotation in your bean class, you are using in your Action and do not provide x.jsp ,exception is thrown.

If you do not want to validate the input simply remove the validation annotation from the bean class.

Upvotes: 2

DiTap
DiTap

Reputation: 369

If you have overridden the validate method in your class file (class="project" in your case), then it requires the necessary input values that you use in the validate method. You can either pass the necessary values or change some validations in the validate method.

Upvotes: 0

struts2
struts2

Reputation: 44

Simple answer - happens when you provide a wrong input . For example - if you have a field named "firstName" which is of type char and if you provide a wrong input ( like , int )

Upvotes: 1

Suryaprakash Pisay
Suryaprakash Pisay

Reputation: 648

<action name="update" method="updatePhase" class="Project">
   <result name="updated">/Project.jsp</result>
   <result name="input">/Project.jsp</result> <!-- add input return type as well in your struts.xml -->
</action>

Generally your execute()/updatePhase() in controller returning updated if everything goes fine . But there are other return types which struts will take care .

You can handle it manually by defying your return values and corresponding

<result name="yourReturnValue">/Project.jsp</result> 

Within inside the corresponding tag.

Hope it's clear now.

Upvotes: 0

durgesh
durgesh

Reputation: 17

I think you have to give fully qualified name under the tag class="" in struts.xml . Then it will start passing your action.

Upvotes: -1

Adi Repalle
Adi Repalle

Reputation: 1

The Result name in Action and struts.xml should be equal. Still if you are getting this error it may be jar file issue. Try to add this jar file in to your library: javassist-3.9.0.GA.jar.

Upvotes: -1

Raheel
Raheel

Reputation: 5163

I had the same error and I changed my struts.xml file

from
<action name="Registeration101" class="Registeration101">
        <result name="success">pages/inputform.jsp</result>
        <result name="done">pages/quoteSuccess.jsp</result>
    </action>
 to
    <action name="Registeration101" class="Registeration101">
        <result name="success">pages/inputform.jsp</result>
        <result name="input">pages/inputform.jsp</result>
        <result name="done">pages/quoteSuccess.jsp</result>
    </action>

basically result name="input" was not defined

Upvotes: 5

Muhammad Kashif Nazar
Muhammad Kashif Nazar

Reputation: 23865

One solution is to specify a result with the name "input" for the action. This is how I solved my problem via the annotation.

Before:

@Action(value = "sendFeedback", results = {
    @Result(name = SUCCESS,type = "json"),
    @Result(name = ERROR,type = "json")})

After:

@Action(value = "sendFeedback", results = {
    @Result(name = SUCCESS,type = "json"),
    @Result(name = INPUT, type = "json"),
    @Result(name = ERROR,type = "json")})

Upvotes: 1

Tommi
Tommi

Reputation: 8608

The error message means that an result named input has not been defined for your action. The result input is a default result returned by Struts when there is a problem with validating the parameters passed to an action. Thus, I recommend to check and ensure that the parameters you are passing from your HTML form match the parameters of your action. Check spelling, data types etc.

Upvotes: 46

Related Questions