SPRING CORE / NOTES</>↗Spring Core22 Jul 2011
In this example we will learn how to declare a bean in Spring Application. We are going to build a simple Maven project to demonstrate it. So let’s begin by setting up our Maven project. Creating a Maven Project Below is the directory structure of our Maven Project. . ├─ pom.xml └─ src └─ main […]
CORE API / NOTES</>↗Core API19 Jun 2011
This example demonstrates how to get print service’s attribute set using the javax.print API. First we find the default printer for the current machine using the PrintServiceLookup class. This will give us a PrintService object, this object might be null if no print service found. The final step is to get the print service attribute […]
CORE API / NOTES</>↗Core API15 Jun 2011
To format a java.util.Date object we use the SimpleDateFormat class. To get back the string pattern that were used to format the date we can use the toPattern() method of this class. package org.kodejava.text; import java.text.SimpleDateFormat; import java.util.Date; public class SimpleDateFormatToPattern { public static void main(String[] args) { SimpleDateFormat format = new SimpleDateFormat("EEEE, dd/MM/yyyy"); // […]
CORE API / NOTES</>↗Core API15 Jun 2011
The example presented in this code snippet show you how to get the available currency codes. We will need the locale information and use the Currency class for this example. package org.kodejava.util; import java.util.Currency; import java.util.Locale; import java.util.Map; import java.util.TreeMap; public class CurrencySymbolDemo { public static void main(String[] args) { CurrencySymbolDemo cs = new CurrencySymbolDemo(); […]
MYBATIS / NOTES</>↗MyBatis10 Jun 2011
In the previous example How do I create MyBatis mapper? you’ve seen how to use a mapper to get a record from the database. In that example the select query is defined in the mapper xml file. For the same functionality MyBatis also offer a solution to use an annotation for the select query. In […]
MYBATIS / NOTES</>↗MyBatis10 Jun 2011
In this example you will see how to create or define a data mapper using the MyBatis. The mapper will communicate our application with the underlying databases where the data is stored. MyBatis data mapper is defined as an interface object. We can either use annotations or the xml mapper to define our database query. […]