As I known, request is like a message that sent from client web browser, and response is the server who received the message and feedback to client. So “request-response cycle” is a term of client-server.
2.Explain how servlets facilitate processing of the request-response cycle.
Servlets is API software that listen a request and base on request to create a response.
3.How do you login to the Tomcat Manager?
First, make sure tomcat is running, then create an account name and password by modify “tomcat-user.xml” file. Then, go to browse and type “localhost:8080”, go to Tomcat Manager by using the username and password that created before.
4.What is the Tomcat Manager used for in the StackStripes application?
Since, we need to run an application on tomcat web server, so we need to get authorize on web server to make the application run, so we need tomcat manager to communicate between application and web server.
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!)
In StackStripes directory it include a folder call “web”, under that folder is web page for JSP, also it had a folder call WEB-INF, it include a stripe library that the system need these when compile with stripes.
6.How do you build a war directory structure in Ant? Where is this accomplished in the StackStripes application?
To build a war directory structure in Ant we need tomcat manager to compile the whole java file and they make a war file (this file same with jar file). Tomcat will use this file to execute the application.
In StackStripes application we run tomcat.build.xml that will do the above process to make a war file and deploy on tomcat web server, then show the application on web browser.
7.How do you install a war directory in a running Tomcat server? What information does the Ant task need to accomplish this?
When Tomcat server running we can use Tomcat Manager to install a war directory. In Ant, we need to run tomcat.build.xml to build war directory.
8.What is the "Model2" architecture? What are its advantages?
Model 2 is combine servlets and JSP together, it’s make the application server more dynamic. The advantages of model 2 is separate process request and respond action, servlets will control all process and send to JSP to respond client side.
9.What are JSP pages? How are they related to servlets?
JSP is Java Server Page is able to receive client request and respond to client, which is able to interact between server and client. JSP is compiled into java servlets by JSP compiler.
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 JSP received a request then servlets will compile the application, we know compile java application that the system will send a lot of compiled data back to client side, so it may take a long time for first time. The java code will store it at the browser cache.
11.What are JSTL tags? Why are they useful? What is an example JSTL tag from the StackStripes system?
JSTL tags is able to call the library from JSP. JSTL can do some code programming code on HTML code i.e. call FOR loop in HTML. The example on StackStripes is
12.What are Stripes tags? Why are they useful? What is an example Stripes tag from the StackStripes system?
Stripes tags are the tags to let JSP recognize which parts need to compile by JSP. If don’t have Stripes tags that JSP won’t be know which components of HTML will send the request to JSP, and JSP won’t be able to compile. For example, all PHP code is within a beckets <$PHP$> outside of this beckets is normal HTML code. There is an example on StackStripes application
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 test java application through the internet protocol and create a test result. JUnit is only test java application in local system and HttpUnit that able to test request and respond from java application server. If without HttpUnit that it won’t be able to test web feature, which is web form button, server connection and web application. Here is an example of HttpUnit on StackStripes WebResponse response = conversation.getResponse(Url);
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?
To implement Double it button that need to change the form ID name and value that display string on Double it button. It didn’t need to change is the HTML tag for create button. Http form is user interface for people easy to interact with the application. If no MVC that user may not be interact with application.
15.What are the equivalence classes that need to be tested for the Double It button?
The goal for Double it button is duplicate default value into stack, so to test Double it button that must be push one value into stack, if the double it button is work, it may have two equal value in the stack.
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 hitting the “Double it” button that it will show double it button on the page, then after hitting Double it button it will direct to java stack application and duplicate value into stack and send it back to original page, and then iterator to display what value into stack.

17.What is the singleton design pattern? What is an example of its use in StackStripes? Why is it needed?
Singleton design pattern is makes many process into one instance or object. An example of its use in StackStripes is
public static synchronized StackModel getInstance() {
return StackModel.theInstance;
}
It operates more efficiently when only one or a few objects exist.
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 TestStackActionBean code is on the server side and the StackActionBean code is on client side, because the TestStackActionBean code is use HttpUnit to go through internet protocol to test the code, and use JUnit to test StackActionBean in local system. Emma only deal with which method in these code are execute or not to create appropriate coverage data, so if one of exercise code doesn’t execute, the emma coverage will not be 100%.
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 – To check the connection of Tomcat web server, make sure Tomcat is running or not.
tomcat.undeploy – Undeploy application on Tomcat Web Server
compile – Compile application on Tomcat Web Server
war – Servlets base on java files and deploy it as an archive file for web call war.
tomcat.deploy - Deploys application on Tomcat Web Server.
junit.tool – Testing application by using test case.
junit.report – Generate test report return what error occur in code.
junit – To run the test case and test the application.
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?
No comments:
Post a Comment