Sample project using Plain JavaSE – Episode 4

Hi, this is the fourth post of a series where i’ll be publishing some samples showing how to develop web applications with Java technology.
This post sample consists on a project ‘staffgest-mvc-freemarker‘ that serves as presentation layer using Freemarker.

This web app is deployed on a embedded Glassfish server .
You can read more about Glassfish Embedded in here.
You can read more about Freemarker in here.
For more context please refer to the previous post.

The proposed flow on the web application  is:

  1.  Visit – ‘localhost:8080/staffgest-mvc-freemarker/new-employee.html’ , where a form to create an employee is showed
    – submit form and “new-employee.ftl” is rendered
  2. Visit – ‘localhost:8080/staffgest-mvc-freemarker/search-employee.html’ , where a form to search an employee is showed
    – submit form and “search-employee.ftl” is rendered

Relevant code snippets:

Web.xml

Controller

Views
“new-employee.html”

“new-employee.ftl”

“search-employee.html”

“search-employee.ftl”

staffgest-mdw‘ , ‘staffgest-mvc-freemarker‘ – are all maven projects, so it should be fairly simple to import and build it. First build “staffgest-mdw” and the run “staffgest-mvc-freemarker” through a main class ‘App.java’.
Hope it’s helpful for someone!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s