Java Module 3

MVC Web Applications and Spring Boot

Schedule A One-on-One With An Instructor

Exit Ticket Form

Weekly Schedule

Mastery Project - Pending

Module Project - Reviews Site

GitHub Classroom - Reviews Site

Opinions. You know the saying...everyone has one. And the Internet has made them easier to consume, or ignore.

Acquisitions, Inc. has many, many products from its years of, well, acquiring things. They have asked you to build a reviews site for some of their current products. The data gathered will help them gain insight into their customer base and the products they have come to enjoy...or enjoy less.

Acquisitions, Inc. requires:

  • Development of a MVC Web Application by a team that practices agile, utilizes test driven design, and values clean code

  • Appropriate use of Git and access to your application on GitHub

  • Useful instructions in the form of a README.md file

  • Ability for Users to:

    • View reviews on products.
    • Organize reviews into categories.
    • Create, update, and delete their own reviews
    • Create and remove hashtags on the reviews.
    • View all reviews associated with a hashtag.

Sprint 1

Prototypes

Rapid Prototyping

Prototype pages for:

  • All:

    • Categories
    • Hashtags
  • Two single pages for each:

    • Review
    • Category
    • Tag
  • Hard code all data and make sure all links connect to the right pages

  • Make HTML pages for each of these entities and add CSS styling.


Sprint 2

Goal - Class Design and Templates

  • Use static resources to start building out each section of the MVC structure

    • The classes that make up the Model section.
    • The templates that make up the View section.
    • The classes that make up the Controller section.
  • Simulate a data layer that will provide storage for your content.

Model

Use the data that you put in your static pages to guide the creation of all of your models. Now that you have pages for two Reviews, two Categories, and two Hashtags, you can actually use that data to inform exactly what fields you model Objects will need.

View

To build our view layer, all we need to do is make templates out of the static pages that we created and convert them to Thymeleaf files

Controller

Our controllers are going to control two important functions, defining request routing (directing traffic) and executing tasks based on the endpoint that is requested. The controllers should communicate with services that provide data and add data to the model object and then pass the model object to the view.

To build a controller you need to have an idea on how your pages are linked together and what data needs to be populated into the model for each template that is returned by that method/endpoint.

Data Layer

Create a class that corresponds to each Model element that will contain a collection of example elements along with methods to retrieve them in specific ways (i.e. findAll, findById, etc.). Naming should reflect the data that is held in that service. (i.e. ReviewService)

Thymeleaf Tips

Iteration

We use th:each to iterate over collections in Thymeleaf. If I had a collection called widgets in my model, each of these having a name attribute, I would do the following to generate a <div> for each of these. widget is the name of my iteration variable, much like the for each loops you're familar with:

<div th:each="widget: ${widgets}" th:text="${widget.name}" />

This would result in something like the following, given the names "fee", "fie", and "foe":

<div>fee</div>
<div>fie</div>
<div>foe</div>

(See the tutorial section on iteration.)

Link URLs

Link urls have a special syntax in Thymeleaf, the @ syntax: @{...}. If I had an object called foo in the model, with a getId() method, and wanted to create a query parameter with the id, I would reference it as follows:

<a th:href="@{'/things/'+${thing.id}}">link text</a>

This would result in the following being rendered, assuming that thing.getId() returns 42:

<a href="/things/42">link text</a>

(See the tutorial section on link urls.)

Materials

Thymeleaf

Resources


Sprint 3

Materials

Goal

  • Include and incorporate an actual database to store our data.
  • Maintain all current Objects and add support for database management

Sprint 4

Goal

  • Make it so a user can add multiple hashtags at one time
  • Add ability to add comments to reviews. Comments should be listed on a review's page after the review's content.

Sprint 5

Landing the plane!

Day 1

  • Finish features
  • Finalize integration tests.

Day 2

  • Bug fixes
  • Finalizing styling

Day 3

  • Presentations
  • Reflection

Mastery Project

Requirements

Blog Prototype

Module Resources

Java

Version Control

Spring Boot

MVC and Server Side Rendering

Sending Requests from the Browser