15

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?

Aleksandr M
  • 24,264
  • 12
  • 69
  • 143
jones
  • 151
  • 1
  • 1
  • 3

10 Answers10

45

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.

Tommi
  • 8,550
  • 5
  • 32
  • 51
5

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

Raheel
  • 4,953
  • 4
  • 34
  • 40
2

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.

Ashish
  • 31
  • 4
2

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.

1

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")})
Kashif Nazar
  • 20,775
  • 5
  • 29
  • 46
1

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 )

struts2
  • 54
  • 1
  • 7
0
<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.

0

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.

DiTap
  • 361
  • 2
  • 5
-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.

Shimon Rachlenko
  • 5,469
  • 40
  • 51
-1

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

Aniket Kulkarni
  • 12,825
  • 9
  • 67
  • 90
durgesh
  • 17
  • 5