A Simple Java Server Page
basic.jsp
<%@ page language=”java” contentType=”text/html;charset=ISO-8859-I” pageEncoding=”ISO-8859-I”%>
<!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=ISO-8859-I”>
<title>Sample JSP</title>
</head>
<body>
<h1>Sample Java Server Page</h1>
<%
for(int i=10;i>0;i--){
out.println(“<h”+i+”>+”welcome to JSP”+”</h”+i+”>”);
}
%>
</body>
</html>
“A scriptlet is a fragment of java code which is placed within delimiters and is executed when the user requests for the page.”
Uses of JSP Constructs
• Scripting elements calling servlet code directly
• Scripting elements calling servlet code indirectly (by means of utility classes)
• Beans
• Servlet/JSP combo (MVC 2 Architecture)
• MVC with JSP expression language (JSTL)
• Custom tag
• MVC with beans and a framework like Struts or JSF
• MVC with beans and a framework like Struts or JSF
Comments
Post a Comment