JSP Scripting elements
<%@ page language="java"
contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert
title here</title>
</head>
<body>
<h1>Java
Server Pages</h1>
<h2><a href="scriptlets.jsp">JSP Scripting Elements </a> </h2>
<h2><a href="implicit.jsp">Implicit Objects </a></h2>
<form action="implicit.jsp">
Name: <input type="text"
name="name">
<input type="submit"
value="Submit"><br/>
</form>
</body>
</html>
scriptlets.jsp
<%@ page language="java"
contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert
title here</title>
</head>
<body>
<h2> JSP
Scripting Elements </h2>
<h2>JSP scriptlet
tag </h2>
<% out.print("Welcome to JP"); %>
<br/>
<% out.print("Welcome to JSP "+ request.getParameter("name")); %>
<br/>
<h1> JSP
expression tag </h1>
<!--
need not write out.print() -->
<%= "Todays Date " %>
<br/>
<%=java.util.Calendar.getInstance().getTime() %>
<h1>JSP
Declaration Tag</h1>
<%! int data=10;%>
<%= data %>
</body>
</html>
How it interprets the data, check below:
How it interprets the data, check below:
JSP Scripting Elements
JSP scriptlet tag
<% out.print("Welcome to JP"); %><% out.print("Welcome to JSP "+ request.getParameter("name")); %>
JSP expression tag
<%= "Todays Date " %><%=java.util.Calendar.getInstance().getTime() %>
No comments:
Post a Comment