<%-- infoDemo.jsp --%> <%-- Displays students' information in a big table --%> <%-- Jeff Offutt, Fall 2001 --%> <%-- This is the demo version - not what I use. --%> <% // Check if user has logged in. // This works with the login servlet. If the user has already logged in, // the jsp is executed normally. Otherwise, the user is fotwared to the // login servlet. session = request.getSession (false); //from loginDemo.java: session.setAttribute ("isLogin", "Yes"); if (session != null) { // A session exists String isLoginStr = (String) session.getAttribute ("isLogin"); boolean isLogin = (isLoginStr != null && isLoginStr.equals ("Yes")); if (!isLogin) { %> <% } } %> Student Information

Student Information for SWE Demo


<% boolean colorFlag = true; %> <% int none=0, beginner=1, intermediate=2, expert=3; %> <% int cntHtml[] = {0, 0, 0, 0}; %> <% int cntJava[] = {0, 0, 0, 0}; %> <% int cntCGI[] = {0, 0, 0, 0}; %> <% int cntJS[] = {0, 0, 0, 0}; %> <% int cntServlets[] = {0, 0, 0, 0}; %> <% infoDemo.loadInfo(); %> <%-- For each student in the array getNumStuds --%> <% for (int i=1; i<=infoDemo.getNumStuds(); i++) {%> <% if (colorFlag == true) { %> <% colorFlag = false; %> <% } else { %> <% colorFlag = true; %> <% } %> <% if (infoDemo.getMajor(i-1).equals ("Other")) { %> <% } else { %> <% } %> <%-- Counters --%> <%-- HTML --%> <% if (infoDemo.getLevelHTML(i-1).equals ("none")) { %> <% cntHtml[none]++; %> <% } else if (infoDemo.getLevelHTML(i-1).equals ("beginner")) { %> <% cntHtml[beginner]++; %> <% } else if (infoDemo.getLevelHTML(i-1).equals ("inter")) { %> <% cntHtml[intermediate]++; %> <% } else if (infoDemo.getLevelHTML(i-1).equals ("expert")) { %> <% cntHtml[expert]++; %> <% } %> <%-- Java --%> <% if (infoDemo.getLevelJava(i-1).equals ("none")) { %> <% cntJava[none]++; %> <% } else if (infoDemo.getLevelJava(i-1).equals ("beginner")) { %> <% cntJava[beginner]++; %> <% } else if (infoDemo.getLevelJava(i-1).equals ("inter")) { %> <% cntJava[intermediate]++; %> <% } else if (infoDemo.getLevelJava(i-1).equals ("expert")) { %> <% cntJava[expert]++; %> <% } %> <%-- CGI --%> <% if (infoDemo.getLevelCGI(i-1).equals ("none")) { %> <% cntCGI[none]++; %> <% } else if (infoDemo.getLevelCGI(i-1).equals ("beginner")) { %> <% cntCGI[beginner]++; %> <% } else if (infoDemo.getLevelCGI(i-1).equals ("inter")) { %> <% cntCGI[intermediate]++; %> <% } else if (infoDemo.getLevelCGI(i-1).equals ("expert")) { %> <% cntCGI[expert]++; %> <% } %> <%-- JS --%> <% if (infoDemo.getLevelJS(i-1).equals ("none")) { %> <% cntJS[none]++; %> <% } else if (infoDemo.getLevelJS(i-1).equals ("beginner")) { %> <% cntJS[beginner]++; %> <% } else if (infoDemo.getLevelJS(i-1).equals ("inter")) { %> <% cntJS[intermediate]++; %> <% } else if (infoDemo.getLevelJS(i-1).equals ("expert")) { %> <% cntJS[expert]++; %> <% } %> <%-- Servlets --%> <% if (infoDemo.getLevelServlets(i-1).equals ("none")) { %> <% cntServlets[none]++; %> <% } else if (infoDemo.getLevelServlets(i-1).equals ("beginner")) { %> <% cntServlets[beginner]++; %> <% } else if (infoDemo.getLevelServlets(i-1).equals ("inter")) { %> <% cntServlets[intermediate]++; %> <% } else if (infoDemo.getLevelServlets(i-1).equals ("expert")) { %> <% cntServlets[expert]++; %> <% } %> <% } // End for loop %>
S# Name PIN Email Phone# Major HTML Java CGI JavaScript Servlets
<%=i%>. <%= infoDemo.getLName(i-1) %>,  <%= infoDemo.getFName(i-1) %> <%= infoDemo.getPin(i-1) %> <%= infoDemo.getEmailAddress(i-1).replace('\r', ',').replace('\n', ' ') %> <%= infoDemo.getPhone(i-1) %><%= infoDemo.getOtherMajor(i-1) %><%= infoDemo.getMajor(i-1) %><%= infoDemo.getLevelHTML(i-1) %> <%= infoDemo.getLevelJava(i-1) %> <%= infoDemo.getLevelCGI(i-1) %> <%= infoDemo.getLevelJS(i-1) %> <%= infoDemo.getLevelServlets(i-1) %>
Totals - None: <%= cntHtml[none] %> <%= cntJava[none] %> <%= cntCGI[none] %> <%= cntJS[none] %> <%= cntServlets[none] %>
Totals - Beginner: <%= cntHtml[beginner] %> <%= cntJava[beginner] %> <%= cntCGI[beginner] %> <%= cntJS[beginner] %> <%= cntServlets[beginner] %>
Totals - Intermediate: <%= cntHtml[intermediate] %> <%= cntJava[intermediate] %> <%= cntCGI[intermediate] %> <%= cntJS[intermediate] %> <%= cntServlets[intermediate] %>
Totals - Expert: <%= cntHtml[expert] %> <%= cntJava[expert] %> <%= cntCGI[expert] %> <%= cntJS[expert] %> <%= cntServlets[expert] %>