1. Describe the JSP life cycle.
Draw a diagram of the various events and transformations.
For each part of the cycle describe the items that are transformed or acted upon and what they are transformed to. In terms of HTML/Java source and bytecode/JSP tags explain where these are present.
2. Describe how you might implement logging in as used in the workshops using the session mechanism explaining what Java classes are involved and using code snippets.
Describe how you would protect pages using this.
Explain how cookies are used to implement sessions. Describe one other common use of sessions explaining the use of any extra
Java classes that would be involved.
Explain the difference between session scope and TWO other scopes.
3. Using either Nielsens HOME RUN or usability principles from the course discuss FIVE usability issues that web site creators should consider. Support your discussion with examples.
4. Using Appendix A answer the following questions about the Java code supplied:
a. Write some Java code that would create an example object from this class.
b. Describe what check you would want to make and what exception could be generated in the insertStudent method.
c. Write a method that finds the youngest age of the students stored in the data structure and some Java code that could be used in a test program to display the value returned by the method on the console or command prompt.
5. Answer the following on an implementation of a LinkedList class in Java.
d. Describe the concept of Linked Lists and explain the operations using them in terms of their efficiency or inefficiency.
b. Provide a Java code definition of a Node class that will be used in a LinkedList class that will store a list of Objects.
c. Give the Java code for an implementation of the removeFirst method outlined below.
d. Draw a diagram of how the removeFirst method below should work.
Do not use the built in Java API LinkedList itself
Assume the following code is already present in the class definition of LinkedList:
private Node first; public Linked List()
{
first = null;
}
/**
Removes the first element in the linked list. @return the removed element
*1
public Object removeFirst()
{
// // // //
}
6. Describe a set of four methods that a queue would need to implement using a circular array and show the Java code to implement them if using an implementation given the outline definition below. Do not use any methods of the Collection classes.
public class CircularArrayQueue
private Object[] buffer; private int currentSize; private int head;
private int tail;
public CircularArrayQueue()
final int INITIAL_SIZE = 10;
buffer = new Object[INITIAL_SIZE]; currentSize = 0;
head = 0;
tail = 0;
/**
Checks whether this queue is empty. @return true if this queue is empty
*/
public boolean empty() { } /**
Adds an element to the tail of this queue. *1 @param newElement the element to add
public void add (Object newElement)
/**
Removes an element from the head of this queue. @return the removed element
public Object remove()
// Grows the buffer if the current size equals the buffer's capacity. private void growBufferlfNecessary()
Appendix A
public class Students
private Student[] array; private int index;
public Students( int sizeIn) 1
array = new Student[sizeIn];
public void insertStudent(Student s)
array[index] = s; index++;
public void printArray()
for(int i = 0; i < array.length; i++) System.out.println(array[i].getName() + " It + array[i].getAge());
1 public class Student
2 {
3 private String name;
4 private int age;
5
b public Student(String nameIn, int ageIn)
6 name nameIn;
age•ageIn;
10
11
public String getName()
13
14 return name;
15
16
17,=, public int •getAge()
18
return age;
2.0
21