Tuesday, October 20, 2009

JSP - use directives to import java libraries

<%@ page import="java.util.*" %>
 
<%@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> 
 
        <% 
        ArrayList ll = new ArrayList();
 
            for (int i=0; i<100; i++) {
                ll.add(i);
            }
        
        %> 
 
        <h1>ArrayList size: <%= ll.size() %> </h1> 
        <h1>Location of item 77: <%= ll.indexOf(77) %> </h1> 
 
    </body> 
</html> 
 
 

No comments:

Post a Comment