Sample project using Plain JavaSE – Episode 2

Hi, this is the second 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-jsf‘ that serves as presentation layer using JSF.

This web app is deployed on a embedded Glassfish server .
You can read more about Glassfish Embedded in here.
You can read more about JSF 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-jsp/new-employee.xhtml’ , where a form to create an employee is showed
    – submit form and “new-employee-result.xhtml” is rendered
  2. Visit – ‘localhost:8080/staffgest-mvc-jsp/search-employee.xhtml’ , where a form to search an employee is showed
    – submit form and “search-employee-result.xhtml” is rendered

Relevant code snippets:

JSF configuration on web.xml
https://gist.github.com/arthurportas/020083d56a8b840eabec350c30b7fb83

Employee Backing Bean
https://gist.github.com/arthurportas/0a2e6bfc8f834144a14cbc47f025d4dd

Views
“new-employee.xhtml”
https://gist.github.com/arthurportas/b726d951faf0c9b380601fc0bd20a12b

“new-employee-result.xhtml”
https://gist.github.com/arthurportas/1d0ad841517f6714fed8764cb318e145

“search-employee.xhtml”
https://gist.github.com/arthurportas/20393e1abb5524657bdae77632bbd3cd

“search-employee-result.xhtml”
https://gist.github.com/arthurportas/a274c18566805c4e3b1bdaab95b3b866

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