Created
April 24, 2015 17:22
-
-
Save rurtubia/a319ab4ae1beec2433c6 to your computer and use it in GitHub Desktop.
Using JSP, runs simple java code on HTML. The browser just sees the HTML equivalent of the text. uses: * java for loop * HTML * JSP scriplets - Comment <%-- --%> - Declaration <% %> - Printing <%= %> * Adds no-cache snippet to avoid caching of code. Coded in Netbeans IDE 8.0.2 Run on Glassfish Server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%-- | |
Document : index | |
Created on : Apr 22, 2015, 12:58:57 PM | |
Author : rurtubiac | |
--%> | |
<%@page contentType="text/html" pageEncoding="UTF-8"%> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
<title>JSP Page</title> | |
</head> | |
<body> | |
<%--Prevents from caching--%> | |
<% | |
response.setHeader("Cache-Control","no-cache"); //HTTP 1.1 | |
response.setHeader("Pragma","no-cache"); //HTTP 1.0 | |
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server | |
%> | |
<h1>Numbers from 1 to 10</h1> | |
<%--Initialization of a Java variable--%> | |
<% | |
int limit = 10; | |
%> | |
<%--Uses a java for loop--%> | |
<%--We can interrupt the java code with HTML by using the terminator scriptler--%> | |
<% | |
for (int i = 0; i < limit; i++) { | |
%> | |
<%--Use of the printing scriptlet--%> | |
<%= i+1%> | |
<br> | |
<% | |
} | |
%> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment