Monday, June 24, 2019

JSP Scripting elements



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:

scriptlets.jsp

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() %>

JSP Declaration Tag

<%! int data=10;%> <%= data %>

No comments:

Post a Comment

Create a Digital Clock using HTML and JavaScript

Create a Digital Clock using HTML and JavaScript  <! DOCTYPE html> < html > < head > ...

Followers

Search This Blog

Popular Posts