Thursday, October 20, 2011

hello world in jsp



 In this post i would like to tell behavior of jsp page. Jsp is just like HTML but it has special tag for handle client request. in above figure you can understand how it work.JSP source code runs on the web server in the JSP Servlet Engine. The JSP Servlet engine dynamically generates the HTML and sends the HTML output to the client's web browser.
following example for print hello world techmemoryspace.wordpress.com in jsp page.

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>Hello World techmemoryspace.wordpress.com!</h1>
</body>
</html>
Out Put
URL : http://localhost:8080/jspHelloWorld/
(i did at my computer so that's you i used as local host. otherwise use server machine URL).

1 comment: