1. Explain in your own words the meaning of the web "request-response cycle". After studying the "request-response cycle" from different online sources, the "request-response cycle" is between a client and a server. Normally, a client requests a task and a server responses it. For example, you are looking for some information about the "request-response cycle" on google, so you type the key inside the searching box. Then, you will receive lists of articles about the "request-response cycle". I think what it is.
2. Explain how servlets facilitate processing of the request-response cycle.
To understand servlets, we have to know what the request-response cycle is. Hence, please read the Q1. A servlet runs on a server. In the "request-response cycle", response is represented as a server. Therefore, when a server responses to a client, the server needs a servlet to generate HTML pages (also known as web pages) which are sent to the client. HTML pages can be static, dynamic or both.
3. How do you login to the Tomcat Manager?
Before you login to the Tomact Mangaer, you will need to know what the username and password is. How can you get the username and password?
Apache-tomcat-6.0.14 -> conf -> tomcatusers Then, you will find the username and password.
Then, go to "http://localhost:8080/" and click "Tomcat Manager". Now, you can enter the username and password.
4. What is the Tomcat Manager used for in the StackStripes application?
In the StackStripes application, the Tomcat manager is to implement the Java Servlet (a server) and the JavaServer pages and to provide an environment for Java code to run in a web application. In the StackStripes application, we use commands like catalina start and catalina stop to deploy and undeploy tasks.
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!)
We would need to install Tomcat tool, Stripes tool and set environment variables. We would also need to copy a .war file from Stripes to Tomcat.
6. How do you build a war directory structure in Ant? Where is this accomplished in the StackStripes application?
When running ant –f build.xml, a war directory would be created under a build directory. Therefore, in our cases, the war directory would be generated inside the build directory.
7. How do you install a war directory in a running Tomcat server? What information does the Ant task need to accomplish this?
In order to install a war directory, the Tomcat tool is needed because a running Tomcat server would create a war directory automatically under the same name within the webapps directory and deployed for use. The information would be like the “catalina start” command to start up a web, then ant –f tomcat.build.xml.
8. What is the "Model2" architecture? What are its advantages?
The “Model2” architecture or Model-View-Controller (MVC) is a hybrid approach for serving dynamic content. Model is included data; View is the interface and Controller is for the requests from client. Its advantages are included the use of both servlets and Java Server Pages. By using both technologies, the “Model2” architecture would have a clean content, clear roles and responsibilities of the developers.
9. What are JSP pages? How are they related to servlets?
Java Server Pages (JSP) is a server side technology that lets you mix static HTML with dynamically-generated HTML. A dynamic Web page contains content that a user can interact with and normally the extension of a file is .jsp not .html. When a JSP page is called, it will be compiled by the JSP engine into a Java servlet. Then, the servlet is compiled by the servlet engine to generate dynamic HTML to be sent to a client.
10. Why is there a delay when retrieving a JSP page for the first time? Where is the Java code for that page stored?
When retrieving a JSP page for the first time, servlet acts a security to check whether or not a web application is dynamical. I am not sure where the Java code is stored. Since the JSP page is from the server side, so the Java code should be stored in the server.
11. What are JSTL tags? Why are they useful? What is an example JSTL tag from the StackStripes system?
JSP Standard Tag Library (JSTL) is a set of tag libraries and is needed when writting dynamic JSP pages.
An example from the StackStripes system would be the "c:forEach" tag in the "index.jsp" file.
12. What are Stripes tags? Why are they useful? What is an example Stripes tag from the StackStripes system?
Stripes tags are included a standard tag library and a dynamic attribute tag library. Their function is to link both a web application and a Java code.
An example from the StackStripes would be the "stripes" tag in the "index.jsp" file.
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 framework based on JUnit, which allows the implementation of automated test scripts for “Web applications”. Therefore, when running HttpUnit testing, tomcat needs to be run at the same time. The example from the stackstripes system will be these objects such as Webconversation, WebResponse, WebForm and WebTable which would need to be used in HttpUnit testing.
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?
In order to run the “Double It” button, a method called “doubleIt” should be added in the StackModel class and an object of iterator would need to be created to hold what is in the original iterator because it is not a good idea to manipulate the original iterator. Then, a string list would be created. All the objects in the newer iterator would be converted into string which would be added into the string list. Finally, push each string from the string list to stack.
What does not need to be changed would be the method call “doubleIt” in the StackActionBean class. It is pretty much the same as push in the StackActionBean but without the argument.
Model-View-Controller (MVC) is separated into three cores which are the input, processing, and output of an application. Therefore, I believe that the StackModel class is represented for Model, the StackActionBean class is represented for Controller and the Web Application is represented for View. It is similar to object orient language. Each class does a different task. When all classes are combined, a product is completed.
15. What are the equivalence classes that need to be tested for the Double It button?
When testing the “Double It” button for the StackModel class in the TestStackModel class, some pushes are needed to be done first. Then, the doubleIt() method would be called for testing purpose.
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.
Before:
After:
17. What is the singleton design pattern? What is an example of its use in StackStripes? Why is it needed?
The singleton design pattern allows many parts of a program to share a single resource to work out the details of the sharing themselves.
An example from the StackStripes would be as follows:
public class StackModel {
/** The singleton StackModel instance. */ private static StackModel theInstance = new StackModel();}
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?
Server side includes the TestStackModel class and client side includes the TestStackActionBean class.
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:
[get] Getting: http://localhost:8080//manager/list
[get] To: C:\ICS413Tools\stackstripes-1.0.1027\list-results.tmp
[delete] Deleting: C:\ICS413Tools\stackstripes-1.0.1027\list-results.tmp
[echo] Tomcat and its management interface contacted successfully.
tomcat.undeploy:
[get] Getting: http://localhost:8080//manager/undeploy?path=/stackstripes
[get] To: C:\ICS413Tools\stackstripes-1.0.1027\remove-results.tmp
[echo] OK - Undeployed application at context path /stackstripes
[delete] Deleting: C:\ICS413Tools\stackstripes-1.0.1027\remove-results.tmp
Compile: checks any new updates which are needed to be compiled.
War: checks any .war files needed to be re-generated.
tomcat.deploy:
[echo] Starting hot deployment to stackstripes.
[unwar] Expanding: C:\ICS413Tools\stackstripes-1.0.1027\build\stackstripes.war into C:\ICS413Tools\stackstripes-1.0.1027\build\tmpwar
[get] Getting: http://localhost:8080/manager/deploy?path=/stackstripes&war
=C:\ICS413Tools\stackstripes-1.0.1027\build/tmpwar
[get] To: C:\ICS413Tools\stackstripes-1.0.1027\install-results.tmp
[echo] Install results: OK - Deployed application at context path /stackstripes
[delete] Deleting: C:\ICS413Tools\stackstripes-1.0.1027\install-results.tmp
Junit.tool: checks whether or not Junit tests are passed.
Junit.report: creates a Junit directory which contains reports to let developers understand what tests are failed and successful.
Junit.: let developers know whether Junit is built successfully or failed.
20. (Optional) If you have experience using one or more other web application frameworks, discuss your initial reactions to Stripes. How is it similar, or different, or better, or worse than your previous experience?
So far, the assignment 26 is my first experience using a web application framework. Hence, it is difficult for me to compare it to other web application frameworks.