title: Simple Way of Display the Result in the Same Page where Query was Made - Spring App
body: <p>I am new user of spring and java technology. I am trying to make a simple search application which take the query in search box and display the result in another pages. The  page that receive the search query is input.jsp -</p>
  
  <pre><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%&gt;
  &lt;%@taglib prefix="form" uri="http://www.springframework.org/tags/form" %&gt;    
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
  &lt;title&gt;Input Form&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;form:form action="output.html" commandName="query"  &gt;
     &lt;table align="center" &gt;
          &lt;tr&gt;
              &lt;td&gt;Enter query :&lt;/td&gt;
              &lt;td&gt;&lt;form:input path="query"/&gt;&lt;/td&gt;
          &lt;/tr&gt;       
          &lt;tr&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;&lt;input type="submit" value="Search" /&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
    &lt;/form:form&gt;
  
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The page that display the result is output.jsp -</p>
  
  <pre><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%&gt;
  &lt;%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt;    
  
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
  &lt;title&gt;Oputput Form&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
     &lt;table align="center" &gt;
          &lt;tr&gt;
              &lt;td&gt;Result:&lt;/td&gt;            
              &lt;td&gt;&lt;c:out value="${query.result}" /&gt;&lt;/td&gt;
          &lt;/tr&gt;      
    &lt;/table&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And the controller 'BaseController.java" is - </p>
  
  <pre><code>    @Controller
      public class BaseController {
  
          private SearchManager srchMgr = new SearchManager();
          private static Logger logger = Logger.getLogger(BaseController.class);
  
          @RequestMapping(value = "/input.html", method = RequestMethod.GET)
          public void getIp(Model model) {
              model.addAttribute(new Query());
          }
          @RequestMapping(value = "/output.html", method = RequestMethod.POST)
              public void showOutput(@ModelAttribute Query query, Model model){
  
                  model.addAttribute("query", query);
      }
  }
  </code></pre>
  
  <p>Now I am trying to display all of the things in output.jsp in input.jsp (the search result). In order to do this what changes should I made? I have tried with placing all the code from output.jsp to input.jsp and have changed @RequestMapping too. But it did not worked.Thanks in Advance</p>