2. Developing_Fabflix - Developing Fabflix UCI CS122B...

Info icon This preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Developing Fabflix UCI - CS122B Jamshid Esmaelnezhad April 5th, 2016 Project 2 ★ ★ ★ Check the project webpage: https://grape.ics.uci. edu/wiki/public/wiki/cs122b-2016-spring-project2 Make sure to understand the design diagram completely. If something is not specified in the project specification, it is left for you to make a reasonable decision. For example, navigating to/from the shopping cart page. 1- Configure Tomcat’s WebApps Manager ★ ★ You installed Tomcat web-server in project 1. Now, first we need to configure Tomcat so can we can view the WebApps Manager. Add the following tags to the tomcat-users.xml file: <role rolename="manager"/> <role rolename="manager-gui"/> <user username="your_username" password="your_password" roles="manager,manager-gui"/> 2- Deploy a Tomcat Application ★ ★ ★ Download TomcatTest.war and TomcatForm.war from project2’s webpage. Use the WebApps manager to deploy each war file. When deployed, go to the web app directory and get familiar with the internal structure of a tomcat web application. 3- Learn Tomcat Servlet Basics ★ ★ ★ Web app internal structure Source code: HttpServlet lifecycle (init() and destroy() methods) The lifecycle of a request: ○ ○ GET and POST request methods URL mapping and the web.xml file 4- Understand the Request and Response ★ Different parts of a request URL: ○ ○ ○ ○ ★ Request parameters ○ ★ request.getContextPath() request.getRequestURI() request.getPathInfo() request.getQueryString() request.getParameter("parameter_name"); Response: ○ ○ response.setContentType("text/html"); PrintWriter out = response.getWriter(); 5- Learn How to Navigate Between Servlets ★ ★ Learn the difference between redirecting and forwarding http://www.javapractices.com/topic/TopicAction.do?Id=181 Redirecting a request response.sendRedirect("/example.html"); ★ Forwarding a request RequestDispatcher dispatcher = request.getRequestDispatcher("/new_module/exmpl.html"); dispatcher.forward(request, response); 6- JSP ★ ★ ★ ★ Try the jspTest.war example from the website. Why is JSP useful? How to break the application logic between servlets and JSP files? How to share information between Servlets and JSPs? 7- Cookies ★ ★ What is a Cookie? An HTTP cookie is a small piece of data sent from a website and stored in the user's web browser while the user is browsing. Structure: 1. 2. ★ Name and value Attributes: (Domain and Path, Expires and Max-age, Secure and HttpOnly) Types: 1. 2. 3. 4. Session cookies Persistent cookies Third-party cookies etc. 8- Session ★ ★ ★ ★ ★ Check the wikipedia page. Working with session key-value pairs Any concurrency issues? Login/logout use cases of session Some useful links on session and cookies: ○ ○ http://www.w3schools.com/js/js_cookies.asp http://www.tutorialspoint.com/servlets/servlets-cookies-handling.htm ○ http://www.journaldev.com/1907/java-servlet-session-management-tutorial-with-examplesof-cookies-httpsession-and-url-rewriting ...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern