Pages

Saturday, June 18, 2011

Simple JSP code

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"
      import="de.vogella.wtp.jsp.controller.*,java.util.*"%>
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-1">
<title>Show all namestitle>
head>
<body>

      <form method="GET" action='HomeController' name="showall">
            <table>
                  <%
                        ArrayList users = new ArrayList();
                        if (request.getSession(true).getValue("users") instanceof ArrayList) {
                              users = (ArrayList) request.getSession(true).getValue("users");
                        }
                        for (User user : users) {
                  %>
                  <tr>
                        <td><input type="checkbox" name="<%=user.getID()%>" />
                        td>
                        <td><%=user.getFirstName()%>td>
                        <td><%=user.getLastName()%>td>
                  tr>

                  <%
                        }
                        ;
                  %>

            table>

            <p>
                  <input type="submit" name="delete" value="delete" />  <input
                        type="submit" name="edit" value="edit" />  <input type="reset"
                        value="reset" />
            p>
      form>



body>
html>

No comments:

Post a Comment