J-Framework Web

J-Framework Web is a set of APIs, components, and practices for building Java web applications based on JSF and PrimeFaces.

Dependency

Most likely, you will NOT need to add direct dependency to this project, since it’s already included in the parent projects or the other framework projects. However, if you need to, the dependency is as follows.

<!-- https://mvnrepository.com/artifact/com.jalalkiswani/j-framework-core -->
<dependency>
    <groupId>com.jalalkiswani</groupId>
    <artifactId>j-framework-web</artifactId>
    <version>7.0.0-SNAPSHOT</version>
</dependency>

Basic Usage

  1. Create a Maven Project with J-App-WebStack as the Parent.

  2. Create an App to run your application easily, it should look something like this:

package com.app;

import com.jk.web.embedded.JKWebApplication;

public class App {
	public static void main(String[] args) {
		JKWebApplication.run();
	}
}

Features

  • Run Faces 4.0, PrimeFaces 12, Weld CDI 4, OmniFaces and others on Tomcat with Zero-Config.

  • Designed, developed, and tested for clean hot-deployments feature in mind.

  • Includes the following JSF configurations out of the box:

    • FacesServlet configurations and mapping.

    • index.xhtml as the default page in each directory.

    • Set the default time-zone of JSF to take the system time-zone.

    • Set the project stage to development and FACELETS_REFRESH_PERIOD to 0 by default for easier development.

  • Includes the following PrimeFaces configuration out of the box:

    • Enable primefaces.SUBMIT to partial for better performance.

    • Set primefaces.MOVE_SCRIPTS_TO_BOTTOM to true to have a cleaner code.

    • Set default Prime Faces theme to nova-light.

Utilities

Include a set of utility Servlets such as:

  • JKLogoutServlet mapped at /logout2.

  • JKVersionsServlet mapped at /version.

  • JKResetConfigServlet mapped at /config/reset.

Filters

Includes a set of utility filters, such as:

  • JKDefaultFilter which handles multiple stuff such as syncing context information.

  • JKSetCharacterEncodingFilter which sets the encoding to UTF8.

    • Includes a set of listeners, such as:

      • JKWebContextListener.

  • JKNoCacheFilter which handles filtering resources that don’t need to be cached.

Controllers

Includes a set of Faces controllers, such as:

  • JKWebController which shall be the super class for any Faces controller.

  • JKUtilWebController mapped at util.

  • JKWebMessagesController.

Built-In Converters

Include a set of useful faces converters, such as:

  • JKDateConvertor

  • JKPasswordConvertor

  • JKTimeConvertor

  • JKTimeStampConvertor

  • JKTypeConvertor

Exception Handlers

The project sets Faces exception handlers to the following handlers, which are based on PrimeFaces exception handlers.

  • JKFacesExceptionHandlerFactory

  • JKFacesExceptionHandler

Utilities and Wrappers

The project contains many utilities and wrappers, such as:

  • JKJsfUtil

  • JKWebUtil

And many others, please refer to the API Documentation for more details.

For production environment config, please have a look at Faces Recommendations.