title: Why HttpServletRequest is used to send a response to the browser?
body: <p>I'm developing a web application by using Spring MVC and I came out with a question.
  In my application, if I want to send attributes to a JSP file, I do something like:</p>
  
  <pre><code>    @RequestMapping("submitRestrictionPolicy")
      public String submitRestrictionPolicy(HttpServletRequest req, HttpServletResponse resp) {
          // Get parameters from form submit
          String state = req.getParameter("checkBox");
  
          // Set attributes to be sent to .jsp page
          req.setAttribute("state", state);
  
          return "restrictionPolicy";
      }
  </code></pre>
  
  <p>And this works normally, I can access the attribute "state" in JSP file and reflect it in browser.</p>
  
  <p>Now I'm wondering why we use HttpServletRequest instead of HttpServletResponse because from my understanding we are sending a response of a request from browser. Shouldn't we use HttpServletResponse for it? I know the answer is no, since there's no "setAttribute" method in HttpServletResponse.</p>
  
  <p>And if it's correct to send responses for a browser request by using HttpServletRequest, what is the importance of HttpServletResponse?</p>