Category: Java

jsf tutorials

JSF ConvertNumber – Standard Converter For Numbers

This tutorial shows how to use the <f:convertNumber> tag. The convertNumber is a standard JSF converter, which converts String/Numbers into a specified format. This converter can be customized using a set of attributes, listed...
xml tutorials

Generate XSD from Java Classes

In this tutorial we show you how to generate XSD from Java Classes using java binding annotations. Java Classes can be converted into XSD schema and vice versa using the jaxb2-maven-plugin. We can specify...
xml tutorials

Generate Java Classes From XSD

This example shows you how to generate Java Classes from XSD using jaxb2-maven-plugin. This plugin uses the XJC which is a JAXB Binding compiler tool that can generate Java Classes from XSD. Maven Project...
java tutorials

Format a Decimal Number with DecimalFormat Example

When you need to format a decimal for example 2 decimals after the comma, grouping numbers, rounding decimals or adding a currency symbol. The java.text.DecimalFormat class is the way to go. The java.text.DecimalFormat allows...
java tutorials

How to convert a String to boolean in Java

We can convert a String to a primitive boolean using the Boolean.parseBoolean method or to a wrapped Boolean class using the Boolean.valueOf. Info: By default the converted String will only convert "true" and "false"...
java tutorials

How to convert a String to double in Java

We can convert a String to a primitive double using the Double.parseDouble method or to a wrapped Double class using the Double.valueOf. When both methods receive an invalid number as argument, a java.lang.NumberFormatException will...
java tutorials

How to convert a String to float in Java

We can convert a String to a primitive float using the Float.parseFloat method or to a wrapped Float class using the Float.valueOf. When both methods receive an invalid number as argument, a java.lang.NumberFormatException will...
java tutorials

How to convert a String to long in Java

We can convert a String to a primitive long using the Long.parseLong method or to a wrapped Long class using the Long.valueOf. When both methods receive an invalid number as argument, a java.lang.NumberFormatException will...
java tutorials

How to convert a String to int in Java

We can convert a String to a primitive int using the Integer.parseInt method or to a wrapped Integer class using the Integer.valueOf. When both methods receive an invalid number as argument, a java.lang.NumberFormatException will...