title: Spring boot application returning the string name of the JSP rather than the JSP itself
body: <p>I am developing a web app using Spring boot. </p>
  
  <p>The use case is, if an user goes to home page, he will be redirected to a new unique URL each time. Eg: www.Qqd.com --> www.qqd.com\jsdh. 
  Next time it would be something different, like www.qqd.com\dkjfbd</p>
  
  <p>But in both the cases, it will show same JSP. 
  I am doing it as a REST framework so that in future I can extend for mobile app development as well. </p>
  
  <p><a href="https://i.stack.imgur.com/oRPf1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oRPf1.png" alt="enter image description here"></a></p>
  
  <pre><code>package com.example.qqd;
  
  import org.apache.log4j.Logger;
  import org.springframework.ui.ModelMap;
  import org.springframework.web.bind.annotation.GetMapping;
  import org.springframework.web.bind.annotation.PathVariable;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.ResponseBody;
  import org.springframework.web.bind.annotation.RestController;
  import org.springframework.web.servlet.ModelAndView;
  
  @RestController
  public class QDetailsService {
  
      Logger log = Logger.getLogger(QDetailsService.class);
  
      @GetMapping("/")
      public ModelAndView getNewUrl(ModelMap model){
         log.info("URL generated is: ");
         return new ModelAndView("redirect:/"+"abcde", model);
      }
  
      @RequestMapping(value="/{url}")
      public String addDetails(@PathVariable String url){
          log.info("URL: " + url + " , detail: " );
          //return new ModelAndView("home.jsp");
          return "home";
      }
  }
  </code></pre>
  
  <p>ServletInitializer.java</p>
  
  <pre><code>public class ServletInitializer extends SpringBootServletInitializer {
  
      @Override
      protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
          return application.sources(QqdApplication.class);
      }
  }
  </code></pre>
  
  <p>QqdApplication.java</p>
  
  <pre><code>@SpringBootApplication //This annotation means, it is the starting point of the app. 
  public class QqdApplication extends SpringBootServletInitializer {
  
      public static void main(String[] args) {
          SpringApplication.run(QqdApplication.class, args);
      }
  }
  </code></pre>