Struts 2 – No result defined for action and result input

Filed Under: Struts 2

Recently while working on a Struts 2 project, I got a strange error message No result defined for action and result input.

Struts2 – No result defined for action and result input

struts2 no result defined for action and result input
Let’s look at a simple scenario where we get the error message “No result defined for action and result input”.

My project had a simple JSP page like below.


<%@ page language="java" contentType="text/html; charset=US-ASCII"
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
<%-- Using Struts2 Tags in JSP --%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Login Page</title>
<h3>Welcome User, please login below</h3>
<s:form action="login">
	<s:textfield name="name" label="User Name"></s:textfield>
	<s:textfield name="pwd" label="Password" type="password"></s:textfield>
	<s:submit value="Login"></s:submit>

And corresponding action class as:

package com.journaldev.struts2.action;

import com.opensymphony.xwork2.ActionSupport;

public class LoginAction extends ActionSupport {

	public String execute(){
		//Some complex business logic
		return SUCCESS;
	public void validate(){
			addFieldError("name", "UserName can't be empty");
			addFieldError("pwd", "Password can't be empty");
	//Java Bean to hold the form parameters
		private String name;
		private String pwd;
		public String getName() {
			return name;
		public void setName(String name) { = name;
		public String getPwd() {
			return pwd;
		public void setPwd(String pwd) {
			this.pwd = pwd;

My struts 2 configuration file was like below.


<?xml version="1.0" encoding="UTF-8"?>

	"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
<constant name="struts.convention.result.path" value="/"></constant>
<package name="user" extends="struts-default">
	<action name="home">
	<action name="login" class="com.journaldev.struts2.action.LoginAction">
	<result name="SUCCESS">/welcome.jsp</result>
	<result name="ERROR">/error.jsp</result>



Everything looked fine and when login action will be invoked, LoginAction will take care of it. Incase of success, welcome.jsp will be sent as response or error.jsp incase of any errors.

But whenever I tried to invoke login action without passing username or password values, I get 404 error and browser response as:

No result defined for action com.journaldev.struts2.action.LoginAction and result input

And in server logs, I was getting following exception stack trace:

Sep 14, 2013 11:40:25 PM com.opensymphony.xwork2.util.logging.jdk.JdkLogger error
SEVERE: Exception occurred during processing request: No result defined for action com.journaldev.struts2.action.LoginAction and result input
No result defined for action com.journaldev.struts2.action.LoginAction and result input
	at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(
	at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(

Fix – No result defined for action and result input

I was clueless for sometime as what is going on, then I looked at the message and it says that “no result is defined for input“. So I modified my login action like below.

<action name="login" class="com.journaldev.struts2.action.LoginAction">
	<result name="SUCCESS">/welcome.jsp</result>
	<result name="ERROR">/error.jsp</result>
	<result name="input">/login.jsp</result>

This simple change solved the issue and I was getting login.jsp page as response with error message set in the validate() method of LoginAction.

The reason is that “input” is the default result returned by Struts 2 whenever there is a problem with validating the parameters passed to an action.

I hope this quick solution will save someone’s time when working with Struts 2 and using form fields validation.


  1. maitrey says:

    Thanks pankaj, This is very helpful

  2. Neil Wright says:

    Thank you! Your post continues to pay dividends. Seems like something worth clarifying in Struts documentation, its a tricky one.

  3. Aditi says:

    This input result doesn’t works when I have migrated my struts project from 2 to 2.5 kindly assist

  4. elon says:

    Thank You!

  5. huy says:

    I have same problem. But this is too helpful . I try to solve it by anyway . And now after read your page, i’m done now ! thanks u

  6. prakash says:

    your posts are very useful. specially above mentioned struts2 error , chewed my head for days , finally got the solution.

  7. Durgesh Patel says:

    you are intelligent thanks bhai your website is very helpful for me.

  8. navaneetha says:

    while uploading a picture into application form i got the error ….. No result defined for action actions.UploadPhotoAction and result input…..what dpes it mean

    1. sunny says:

      i have got the same error.

      would you tell me how to issue that.

      thx very much !

  9. Vivek says:

    I solved my issue by your post. Thanks

  10. Tan Pham says:

    Thank you very much. Your website is really helpful for me to study struts 2.

  11. Saggie says:

    Thanks A Lot…

  12. Moh Samiullah says:

    Thanks alot.. this is really helpful for me. I spent almost couple of days before coming to this.

    1. VK says:

      Useful post .Thanks a ton 馃檪

  13. Hariramanan T says:

    This is very helpful for me,I also got this problem,

    thanks for this tips

Comments are closed.

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors