Saturday, 4 April 2015

JSP _Get _Method_example

(1)write below code example for html form   save it  as form.html  & save this file under path="C:\xampp\tomcat\webapps\ROOT" :

<form action="main.jsp" method="GET">
First Name: <input type="text" name="first_name">
<br />
Last Name: <input type="text" name="last_name" />
<input type="submit" value="Submit" />

(2)now use get method for collecting  form value  save it main.jsp file under path= "C:\xampp\tomcat\webapps\ROOT":

<title>Using GET Method to Read Form Data</title>
<h1>Using GET Method to Read Form Data</h1>
<li><p><b>First Name:</b>
   <%= request.getParameter("first_name")%>
<li><p><b>Last  Name:</b>
   <%= request.getParameter("last_name")%>

(4)now runt jsp file:


No comments:

Post a Comment