Sample project using Plain JavaSE – Episode 1

Hi, this is the initial post of a series where i’ll be publishing some samples showing how to develop web applications with Java technology.
I’ll try to start with a very simple example and make some progress visiting several APIs/Application Servers  from the JEE stack.
This post sample consists on three projects that only uses POJOs.
The adopted subject is an application with codename ‘staffgest’ with employee management APIs.

The adopted architecture consists on a base project -”staffgest-mdw” that has the middleware service layer and the persistence layer(very simple, in memory List).
Through our journey, i’ll be decoupling the persistence layer and the presentation layer for demonstration purposes.
I’ll deliver two sample projects – “staffgest-text” and “staffgest-mvc-jsp” having the presentation layer for -”staffgest-mdw”.
“staffgest-text” is a JSE console app and”staffgest-mvc-jsp” is a web app deployed on a embedded Glassfish server .
You can read more about Glassfish Embedded in here.

The proposed flow on the web application  is:

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

Relevant code snippets:

Controller

Views
“new-employee.html”

“new-employee.jsp”

“search-employee.html”

“search-employee.jsp”

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

Advertisements

One thought on “Sample project using Plain JavaSE – Episode 1

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