title: How to transfer String from Servlet to JSP?
body: <p>servlet file</p>
  
  <pre><code>String str = req.getParameter("str");
  req.setAttribute("str", "java");
  getServletContext().getRequestDispatcher("/us.jsp").forward(req, resp);
  </code></pre>
  
  <p>jsp file </p>
  
  <pre><code>&lt;jsp:useBean id="str" class="hws" scope="request"&gt;
  </code></pre>
  
  <p>or</p>
  
  <pre><code>&lt;div align="center"&gt;
      &lt;textarea readonly name="" cols="50" rows="25"&gt;&lt;%= request.getAttribute("str") %&gt;&lt;/ textarea&gt;
  &lt;/div&gt;
  &lt;form action="/us" method="post"&gt;
      &lt;div align="center"&gt;
          &lt;textarea name="str" cols="50" rows="3"&gt;welcome to my program&lt;/textarea&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>