1.) Explain in your own words the meaning of the web "request-response cycle". The request-response cycle is basically the cycle where a user looks at a page, clicks on some object which then tells the browser to send a HTTP request to the server. The server in turn takes the request, works it out and sends back a response. (Wash, Rinse, Repeat.)
2.) Explain how servlets facilitate processing of the request-response cycle.
Servlets are basically java classes that reside on the server. They process the information sent by the user and returns data accordingly. This allows for dynamic web pages.
3.) How do you login to the Tomcat Manager?
First, tomcat must be running. Then go to the localhost manager page on your web browser or through ant. (http://localhost:8080/manager/list). Enter the username and password that was set in the tomcat conf directory.
4.) What is the Tomcat Manager used for in the StackStripes application?
The Tomcat Manager is used to deploy the StackStripes Application on to tomcat. Since tomcat is password protected, we use the manager to log in and deploy or undeploy the application.
5.) What is the directory and file layout of an installed web application like StackStripes? (This is NOT the same as the directory and file layout of the StackStripes distribution!)
Inside StackStripes is…
Stackstripes\index.jsp //homepage
Stackstripes\META-INF //meta info
Stackstripes\WEB-INF //web info
Stackstripes\WEB-INF\web.xml // xml containing configuration info
Stackstripes\WEB-INF\classes //classes
Stackstripes\WEB-INF\classes\commons-logging.properites //config info
Stackstripes\WEB-INF\classes\log4j.properites //log4j info
Stackstripes\WEB-INF\classes\StripesResources.properites //stripes resources info
Stackstripes\WEB-INF\classes\edu/ // all the things I’ve written
6.) How do you build a war directory structure in Ant? Where is this accomplished in the StackStripes application?
The stack Stripes application builds the war directory through ant in the build.xml file. To build the war directory you need the location of the directory to be created, the web xml file with all the configurations, and all the side info like classes, libraries, and file sets.
The build.xml file should set all these attributes accordingly.
7.) How do you install a war directory in a running Tomcat server? What information does the Ant task need to accomplish this?
Installing a war directory in a running Tomcat server is as simple as just copying the war directory into the webapps folder in Tomcat. The webapps directory is found in the home directory for CATALINA. This can also be accomplished in ant but just setting the destination directory to the webapps folder.
8.) What is the "Model2" architecture? What are its advantages?
The model2 or MVC (model – view – controller) architecture is a architecture pattern that consist of a large amount of data to the user i.e. the model and represents in it a view i.e. interface so that the changes do not affect the data. This is done through an intermediate called the controller. The advantage is it solves the problem of decoupling data access from user interaction.
9.) What are JSP pages? How are they related to servlets?
JSP pages are Java Server Pages and are basically html pages with JavaScript embedded. The JavaScript is compiled into a servlet, and the servlet handles, processes, and return data to the html page where the script is located. This allows for dynamic html pages.
10.) Why is there a delay when retrieving a JSP page for the first time? Where is the Java code for that page stored?
There is a delay when retrieving a JSP page for the first time because the server needs to compile the JSP pages into a servlet. Afterwards the servlet is held within memory on the server for as long as needed. The Java code for that page is stored within the page itself.
11.) What are JSTL tags? Why are they useful? What is an example JSTL tag from the StackStripes system?
JSTL tags are JSP Standard Tag Library tags are simply tags that surround core functionality commonly needed to make dynamic html pages. They are useful because they are in XML standard format and work well in html. This avoids the need to write the java code into the html making the html code easy to read and edit by someone that does not know Java.
Example:
${element}
12.) What are Stripes tags? Why are they useful? What is an example Stripes tag from the StackStripes system?
Stripes tags are basically html tags that allow the linking of button and fields on a webpage to their appropriate java classes. They are useful because they link a button or such to the respective get or set function in java which saves a lot of code.
Example:
13.) What is HttpUnit? How is it different from JUnit? Why is it useful? What is an example use of HttpUnit from the StackStripes system?
HttpUnit is a java class that allows a programmer to access web sites without a browser. It is useful for testing any Java code that deals with web pages because it can go beyond JUnit because JUnit will only test java code running on the client.
Example:
WebForm pushForm = response.getFormWithID(PushForm);
WebRequest pushRequest = pushForm.getRequest();
pushRequest.setParameter(numToPush, "1");
response = conversation.getResponse(pushRequest);
14.) What needed to be changed in order to implement the Double It button? What didn't need to be changed? What did you learn about the MVC design pattern from this exercise?
All that you needed to do was to create a DoubleIt method for the Action bean and a double it button in the index.jsp file. Nothing else was needed. I actually didn’t learn too much about the MVC design pattern through this other than the button and the method needs to have a relevant link.
15.) What are the equivalence classes that need to be tested for the Double It button?
The equivalence classes would be to test on an empty stack, a stack with one or more object, and a stack with a ridiculously large amount of objects.
16.) Provide two screen images of your new StackStripes application with the Double It button, one showing the page before and one showing the page after hitting the "Double It" button.


17.) What is the singleton design pattern? What is an example of its use in StackStripes? Why is it needed?
The singleton design pattern is a pattern that restricts the instantiation of a class to just one object. This is needed because we want all users to interact with just one instantiation of the stack class. This way all the users will have and work on the same information even through multiple “views” across the internet.
Example:
private static StackModel theInstance = new StackModel();
private ClearStack stack;
private StackModel() {
this.stack = new ClearStack();
}
18.) Some of the StackStripes tests exercise code on the "server side", while others exercise code on the "client" side. Which test classes exercise code on the "server", and which exercise code on the "client"? How does Emma deal with this to create appropriate coverage data?
The file TestStackModel.java exercises test cases on the client side while TestStackActionBean.java exercises test cases on the server side. Emma deals with this to create appropriate coverage data by shutting down Tomcat.
19.) Running 'ant -f junit.build.xml' results in the following target invocations: tomcat.check, tomcat.undeploy, compile, war, tomcat.deploy, junit.tool, junit.report, junit. Explain what each of these targets do.
Tomcat.check
This checks to see if tomcat is up and running.
Tomcat.undeploy
This undeploy the application from tomcat.
Compile
Complies the code, what else?
War
This builds the war directory.
Tomcat.deploy
This deploys the application on Tomcat.
Junit.tool
This runs the JUnit test on the given code.
Junit.report
Reports any errors found in the JUnit tests.
JUnit
This runs the Junit.tool and Junit.report tasks. It will display errors if found.