Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments
 
Reading Request Information
Reading Request Information Retrieving the data posted to a JSP file from HTML file Now I will show you how to retrieve the data posted from a HTML file in a JSP page. Consider an html page that prompts the user to enter his/her name, let's call
 
Search Tutorials:
 
Software Solutions and Services
 

 
Google Custom Search:
Website Designing Services
 
Web Designing Packages From $150!
 
Website Designing Company Web Hosting
 
Website Designing Quotation

Retrieving the data posted to a JSP file from HTML file

                          

Now I will show you how to retrieve the data posted from a HTML file in a JSP page. Consider an html page that prompts the user to enter his/her name, let's call it getname.htm. Here is the code of the html file: 

 

 

 

 

 

<html>
<head>
<title>
Enter your name</title>
</head>
<body>

<p>&nbsp;</p>

<form method=
"POST" action="showname.jsp">

<p><font color=
"#800000" size="5">Enter your name:</font><input type
=
"text" name="username" size="20"></p>

<p><input type=
"submit" value="Submit" name="B1"></p>
</form>
</body>
</html>

 

The target of form is "showname.jsp", which displays the name entered by the user. To retrieve the value entered by the user we uses the

request.getParameter("username");

code.

Here is the code of "showname.jsp" file:

<%@page contentType="text/html" %>

<!--

http://www.roseindia.net/jsp

-->

<html>

<body>

<p><font size="6">Welcome :&nbsp; <%=request.getParam
eter("username")%></font></p>

</body>

</html>

 

 

Execute the example.

  Download the  code

                          

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

12 comments so far (
post your own) View All Comments Latest 10 Comments:

hi,
Can u please tell me what should the web.xml file contain when running a standalone jsp file on tomcat5.0
thanks

Posted by sairaj on Sunday, 10.5.08 @ 23:07pm | #80914

Execute the example is not working

Posted by Utam on Friday, 10.3.08 @ 09:56am | #80857

how to run a jsp program

Posted by Sayan Datta on Monday, 09.8.08 @ 01:47am | #77838

Pl Sir Could you tell me How to Transfer files.. using JSP??

Posted by Tushar on Monday, 02.25.08 @ 19:43pm | #49972

Thanks For Your Tut.
Its, Really Help Me To Build My JSP Project

Posted by Abhishek on Sunday, 02.17.08 @ 07:31am | #48710

u r tutorials r good!..keep up t good job!

Posted by mahesh on Tuesday, 01.29.08 @ 21:54pm | #46515

I want to get my attached file. Wat is the syntax?

Posted by senthil on Sunday, 10.7.07 @ 11:55am | #32306

can u give me the detail to retrieve infn from an jsp output html file

Posted by gimsy on Saturday, 09.29.07 @ 18:46pm | #30482

we cant execute the above mentioned code

Posted by sy on Wednesday, 07.18.07 @ 17:52pm | #21504

please give me the answer

Posted by harika on Monday, 07.2.07 @ 10:33am | #20566

Training Courses
Tell A Friend
Your Friend Name
Search Tutorials:

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.