title: Spring MVC annotations always requires Response object
body: <p>I am trying to convert controllers from the old inheritance framework to the new annotations.</p>
  
  <p>Here's an existing controller:</p>
  
  <pre><code>public class SelectedTabController extends AbstractController {
  
  private TabSelectionHelper tabSelectionHelper;
  
  public ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
      String param = request.getParameter("selectedTab");
      if (param != null)
          tabSelectionHelper.setSelectedTabTo(param);
      return null;
  }
  
  public void setTabSelectionHelper(TabSelectionHelper tabSelectionHelper) {
      this.tabSelectionHelper = tabSelectionHelper;
  }
  </code></pre>
  
  <p>And after conversion I have this:</p>
  
  <pre><code>@Controller
  public class SelectedTabController {
  
      private TabSelectionHelper tabSelectionHelper;
  
      @Autowired
      public SelectedTabController(@Qualifier(value = "tabSelectionHelper") TabSelectionHelper tabSelectionHelper) {
          this.tabSelectionHelper = tabSelectionHelper;
      }
  
      @RequestMapping("/selectedTab")
      public void selectTab(String selectedTab, HttpServletResponse response) throws Exception {
          //String param = request.getParameter("selectedTab");
          if (selectedTab != null)
              tabSelectionHelper.setSelectedTabTo(selectedTab);
      }
  }
  </code></pre>
  
  <p>This works but there is a (redundant) HttpServletResponse object in the selectTab paramter list. If I remove it, then the JQuery call says the server returns 500 and the call fails.</p>
  
  <p>Any help?</p>
  
  <p>The stacktrace shows:</p>
  
  <pre><code>javax.servlet.ServletException: Could not resolve view with name 'selectedTab' in servlet with name 'prodman'
  </code></pre>
  
  <p>So it is trying to find a view and failing. However, there is NO view to display as its a backend callby JQuery.</p>
  
  <p>I guess by declaring the response object, Spring thinks I will write the response.</p>
  
  <p>How can I prevent Spring from trying to resolve a view?</p>