I trie to send data from a jsp form to a servlet, but im not able to read the data sended via POST method in the servlet. this is the servlet code
public class TUhServlet extends HttpServlet {
public void doPost(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
String s= req.getParameter("post_text");
System.out.println(s);
resp.sendRedirect("/tuh.jsp");
}
}
This is the form in tuh.jsp
<form class="post_form" action="./"
method="post" enctype="multipart/form-data">
0"/><br/>
Message : <input name="post_text" type="text" size="30" maxlength="30"/>
<p><input type="submit" value="Post!"/></p>
<input type="hidden" name="type" value="post"/>
</form>
web.xml
<servlet>
<servlet-name>TUh</servlet-name>
<servlet-class>tuh.TUhServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>TUh</servlet-name>
<url-pattern>/tuh</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>tuh.jsp</welcome-file>
</welcome-file-list>
</web-app>