JSPs and Servlets Tutorial 05 - The POST Method and Passing Parameters

Java Brains · 299K views · 2011 · 13:24

Open on YouTube

Web developmentPython, Ruby & scripting languagestutorial

Why Stack Overflow recommends it

Stack Overflow users cite it as the tutorial they were following when their servlet form posts failed, so it appears mostly in questions about forms, action URLs and 404 errors.

Recommended by 1 people across 1 different months, 2012 to 2016.

What it is

A 13-minute tutorial from Java Brains on handling HTTP GET and POST requests in Java servlets using doGet and doPost. It also shows how request parameters are passed from an HTML form to a servlet, working in Eclipse with Tomcat.

What people said

Recommends CodeMed · 2012-04 · Stack Overflow · on “html form not rendering in java servlet”

I am doing a very simple tutorial to learn java servlet programming. For some reason, the browser is not rendering the submit button in the html form that I am writing while doing the tutorial in eclipse. I have checked the code many times, including trying many small changes and even googling to confirm that I did in fact remember my basic html. But the problem persists. Specifically, when I run SimpleForm.html on my local Tomcat server from within eclipse, it renders the userName input box, but then it just outputs text versions of all the html code after that, starting with the input tag for the submit button. Here is the information required to recreate my problem. Can anyone show me how

Cites skiabox · 2013-03 · Stack Overflow · on “Post request is not working in my servlet but get request does”

In fact I am following this tutorial ( [this video] ) and this guy manages the same result by using the simple /XmlServletPath as an action parameter and not the full path, but he uses another ide (Eclipse).

Cites Rafaf Tahsin · 2015-06 · Stack Overflow · on “html form action not working when using eclipse”

I am new to JSP and Java Servlet. I was going through this tutorial [this video] by Java Brains. In this tutorial get and post method is handled. I wrote my html code under web-content. </head> <body> <form action=" [LINK] " method="post"> <input name="userName" /> <input type="submit" /> </form> </body> Following is the hello.java file import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; // @WebServlet("/hello") public class hello extends HttpServlet { private static final long ser

Cites Nathan · 2016-02 · Stack Overflow · on “html not using servlet”

I'm running through the java brains tutorials for jsp. I'm at the end of this tutorial [this video] My current issue is when I run my html submit form page I get my submit box with the url [LINK] When entering in information and clicking submit it wont redirect to my servlet page. I get a 404 Not Found instead with this url [LINK] If I put in a url of [LINK] I'm able to hit the servlet code with an output of Hello!testinfo. Im running tomcat on Intellij. XmlServlet.java @WebServlet(name = "XmlServlet") public class XmlServlet extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } protected void doGet(HttpServl