I want to display the text from the text area of an html into a servlet using a button to connect them. The problem is that i dont know how to take the information from the text area to display in the servlet. This is my method so far:
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException
    {
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
        out.println("<h1>Display content here </h1>");
//Here I want to have the text area content displayed.
        out.println();
    }
}
Here is my html:
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Sample</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    </head>
    <body>
        <div>
            <p>show content of text area when clicking the button</p>
            <p></p>    
                <form action="MyServlet" method="GET">
                <textarea name= "name" rows="1" cols="30"></textarea>
                <p></p> 
                <button type="submit" href="MyServlet.do">Get content</button></form>
        </div>
    </body>
</html>
 
    