In this JSP Tutorial, we will learn how to process html form input and send replay back to the browser.
Html
1 2 3 4 5 6 7 |
<body> <!-- Sample 01: Html Form with Action in JSP --> <Form action="FirstJSP.jsp"> Name: <Input type="text" name="PersonName"> <input type="submit"> </Form> </body> |
JSP
1 2 3 4 5 6 7 8 |
<% //Sample 02: Get the Name and Greet the Person String name = request.getParameter("PersonName"); if (name!=null) { out.println("Welcome to JSP Mr. " + name ); } %> |
Categories: JSP