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> </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 : <%=request.getParam
eter("username")%></font></p>
</body>
</html>
Popular Posts
-
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...
-
ADO .NET Most applications need data access at one point of time making it a crucial component when working with applications. Data access i...
-
STRINGS: The way a group of integers can be stored in an integer array, similarly a group of characters can be stored in a character array. ...
-
The SQL MAX aggregate function allows us to select the highest (maximum) value for a certain column. The SQL MAX function syntax is very sim...
-
Introduction: So far, you have dealt with a single class that contains main(..) method. In this exercise, you are going to create mulitple ...
-
A program is usually not limited to a linear sequence of instructions. During its process it may bifurcate, repeat code or take decisions. F...
-
The C language was developed in 1972 by Dennis Richie at Bell Telephone laboratories, primarily as a systems programming language. That is, ...
-
The foundation of every Relational Database Management System is a database object called table. Every database consists of one or more tabl...
-
5.2 .NET Application Scenarios Managed code can be used to develop a variety of different kinds of software. First, it is worth men...
-
We have already seen how variables are seen as memory cells that can be accessed using their identifiers. This way we did not have to care a...
Subscribe to:
Post Comments (Atom)
JavaServer Pages (JSP) lets you separate the dynamic part of your pages from the static HTML. You simply write the regular HTML in the normal manner, using whatever Web-page-building tools you normally use.
ReplyDeleteAmazing blog and very interesting stuff you got here! I definitely learned a lot from reading through some of your earlier posts as well and decided to drop a comment on this one!
ReplyDeleteWhat you're saying is completely true. I know that everybody must say the same thing, but I just think that you put it in a way that everyone can understand. I'm sure you'll reach so many people with what you've got to say.
ReplyDelete