title: Cannot redirect a JSP file and display values using Struts 2
body: <p>I have created a simple program that gets the firstname and lastname of a user using a textfield. But the problem is that when I click the submit button I cannot redirect it to another jsp file which shows the firstname and lastname of the user.</p>
  <p><strong>Here's my <code>HelloAction</code> class:</strong></p>
  <pre><code>package com.novamsc.training.struts.action;
  
  import com.opensymphony.xwork2.ActionSupport;
  
  public class HelloAction extends ActionSupport {
  
      private String firstName;
      private String lastName;
      
      public String user(){
          return &quot;hello&quot;;
      }
  
      public String getFirstName() {
          return firstName;
      }
  
      public void setFirstName(String firstName) {
          this.firstName = firstName;
      }
  
      public String getLastName() {
          return lastName;
      }
  
      public void setLastName(String lastName) {
          this.lastName = lastName;
      }
      
      public String display(){
          return &quot;hi&quot;;
      }
  }
  </code></pre>
  <p><strong>Here's my <code>userInput.jsp</code> file:</strong></p>
  
  <pre class="lang-jsp prettyprint-override"><code>&lt;%@page contentType=&quot;text/html&quot; pageEncoding=&quot;UTF-8&quot;%&gt;
  &lt;%@ taglib uri=&quot;/struts-tags&quot; prefix=&quot;s&quot;%&gt;
  
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;&gt;
  &lt;title&gt;User Form&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;s:form name=&quot;inputData&quot;&gt;
      &lt;s:textfield key=&quot;firstName&quot;/&gt;
      &lt;s:textfield key=&quot;lastName&quot;/&gt;
      &lt;s:submit/&gt;
      &lt;/s:form&gt;
  
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  <p><strong>Here's my <code>resultInput.jsp</code> file:</strong></p>
  <pre class="lang-java prettyprint-override"><code>&lt;%@page contentType=&quot;text/html&quot; pageEncoding=&quot;UTF-8&quot;%&gt;
  &lt;%@ taglib uri=&quot;/struts-tags&quot; prefix=&quot;s&quot;%&gt;
  
  &lt;html&gt;
  
  &lt;head&gt;
  &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;&gt;
  &lt;title&gt;Get Result&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;p&gt;
      &lt;s:property value=&quot;firstName&quot; /&gt;
      &lt;/p&gt;
      &lt;p&gt;
          &lt;s:property value=&quot;lastName&quot; /&gt;
      &lt;/p&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  <p><strong>Here's my <code>struts-traning.xml</code> file:</strong></p>
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&gt;
  &lt;!DOCTYPE struts PUBLIC
          &quot;-//Apache Software Foundation//DTD Struts Configuration 2.0//EN&quot;
          &quot;http://struts.apache.org/dtds/struts-2.0.dtd&quot;&gt;
  
  &lt;struts&gt;
  
      &lt;package name=&quot;hello&quot; namespace=&quot;/exercise&quot; extends=&quot;training-default&quot;&gt;
  
          &lt;action name=&quot;userInput&quot; class=&quot;com.novamsc.training.struts.action.HelloAction&quot;
              method=&quot;user&quot;&gt;
              &lt;result name=&quot;hello&quot;&gt;/jsp/userInput.jsp&lt;/result&gt;
          &lt;/action&gt;
  
          &lt;action name=&quot;inputData&quot; class=&quot;com.novamsc.training.struts.action.HelloAction&quot;
              method=&quot;display&quot;&gt;
              &lt;result name=&quot;hi&quot;&gt;/jsp/resultInput.jsp&lt;/result&gt;
          &lt;/action&gt;
      &lt;/package&gt;
  
  &lt;/struts&gt;
  </code></pre>