JKFramework Web

JK-Framework Web is a set of API’s, components, and practices for building Java web applications based on JSF and PrimeFaces.

Dependency

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

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

Basic Usage

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

  2. Create an App to run your application easily, it should looks 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, PrimceFaces 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 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 many stuff such as syncing context information.

  • EncodingFilter which sets the the encoding to UTF8

    • Includes a set of listeners, such as:

Controllers

Includes a set of Faces controllers, such as:

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

  • JKUtilWebController mapped at util

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 for refer to the API Documentation for more details.

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