Code Monkey home page Code Monkey logo

formarete's Introduction

FormaReTe

An Eclipse workspace used as benchmark for a course I taught on February-April 2015 about Servlets, JSPs, Struts2, Hibernate and Spring with Maven.

As reference documentation I mainly used and adapted tutorials I found online, which are listed at the end of this document. The projects described below are entirely made by me.

dynamic

Default Eclipse project made through the "Create dynamic web project" wizard. Note how web content goes in a custom directory called WebContent.

quickstart

Our first Maven project, made with the Quickstart Archetype and then modified to our needs. We still use JUnit 3.x, but we'll change it in later projects.

servlet

Two different ways to implement authentication logic: through a login servlet and with an authentication filter. We also add a cookie manager filter because we assume that this project will be run in an environment that cannot keep sessions between server instances.

mvc

A small digression on how the Publisher/Subscriber pattern works, and how it integrates in an MVC project. In the tests we can see the difference between updating the View directly from the Controller and doing it indirectly by subscribing to changes in the Model.

struts

Our first Struts2 webapp. It basically just implements what we have done in the servlet project, but using Struts Actions. Filtering is implemented here by using the Preparable interface: although it doesn't allow much flexibility, it keeps the authentication logic testable.

sessionaware

Two different ways to access servlet-specific content: through the ServletActionContext class or using the SessionAware interface. The latter keeps the Action a POJO. We also show Struts' i18n.

todos

A recap on Struts actions by implementing a simple TodoMVC webapp.

auth-todos

Putting it all together we create a TodoMVC app with authentication support. This time however we try to introduce Interceptors as a mean to prevent unauthorized access. This creates a lot of problems and makes authentication untestable, but improves cohesion and modularity.

spruts

Spring + Struts. We inject Actions in the struts.xml as Spring beans and prove how flexible it is to inject a property without specifying how it is constructed or which implementation is chosen.

hiberstruts

Next we introduce Hibernate and integrate it with Struts2. We show two different ways of marking objects as persistent entities (through XML or annotations) and provide a ServletContextListener as a best practice to initialize Hibernate at startup.

join

A small digression on relationships between entities and cascade strategies when removing an object that has references. It is also an exercise on how to use Hibernate with Spring without the need of a webapp context.

hiberspruts

This project puts all the bits together: A full-stack webapp with Struts and Hibernate, all managed by Spring, all built with Maven.

mytodos

As a final exam for the course I asked to create a multi-user TodosMVC application with authentication support and real persistence.

feisbuc

Another use case, to make things more complex: we modeled a rough Facebook-like webapp with very few features available, but it challenged us to perform a join from a Java class to itself in the user -> friends relationship.

Reference

formarete's People

Contributors

iceonfire avatar

Watchers

James Cloos avatar Roby Lombardo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.