Category: Java
Detect OS Name and Version Java
Java is Platform independent and can run everywhere. Knowing this, it can be worth knowing in what operation system the application is running. To detect the current operation system, you can use the OSInfo...
Get Current Working Directory in Java
You can retrieve the current working directory by calling System.getProperty(“user.dir”). This returns the root folder of your current java project. Example package com.memorynotfound.file; import java.io.File; public class FindCurrentWorkingDirectory { public static void main(String… args){...
Find User Home Directory in Java
The System class maintains a Properties object that describes the configuration of the current working environment. Within these properties there exists one that identifies the users home directory. In most scenarios this will work,...
GSON Versioning Support with @Since Annotation
GSON introduced the @Since annotation to support multiple versions of the same object. We can use this annotation on Classes and Fields. In order to enable this feature we need to register a version...
JSF Bootstrap Alert Closable Info, Warning and Error Styled Messages
This tutorial shows you how to override the default JSF <h:messages> renderer with Bootstrap alert closable and with glyphicon icon enhanced JSF info, warning, error and fatal styled messages. As we override the default...
JSF Pass Parameters in Localized Error Messages
When an error occurs in the backend and you need to inform the user what happened, you can display an appropriate error message. JSF provides an easy utility to display these messages. You can...
JSF Component listener with @ListenerFor
This tutorial shows how to add a listener to a component using the @ListenerFor and @ListenersFor annotation. The @ListenerFor annotation allows a component to subscribe to particular events with the component itself being the...
JSF SystemEventListener Example
This tutorial shows you how to use the JSF SystemEventListener. A SystemEventListener can listen to many registered system events. Those system events can be fired by many kinds of sources (components). We can specify...
Debug JSF Lifecycle with Custom DebugPhaseListener
This tutorial shows how to debug JSF Lifecycle with a custom DebugPhaseListener. The first place that most developers check for information about where issues are occurring is the application logs. As you are debugging...