MYBATIS / NOTES</>↗MyBatis06 Jun 2012
MyBatis comes with a complete configuration classes that allows us to create a configuration object programmatically without using the XML file. In this code snippet you’ll see how to create a SqlSessionFactory object without XML configuration file. We start by obtaining a javax.sql.DataSource object. Then we create a TransactionFactory object. With these two objects we […]
SWING / NOTES</>↗Swing06 Jun 2012
package org.kodejava.swing; import javax.swing.*; import java.awt.*; public class WindowTaskbarFlash extends JFrame { private WindowTaskbarFlash() throws HeadlessException { initUI(); } public static void main(String[] args) { SwingUtilities.invokeLater( () -> new WindowTaskbarFlash().setVisible(true)); } private void initUI() { setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); pack(); setSize(200, 200); setState(Frame.ICONIFIED); // Demonstrate flashes the application...
SWING / NOTES</>↗Swing06 Jun 2012
In the following code snippet you’ll learn how to programmatically change the frame state of a JFrame component in a Swing application. The JFrame states are represented as a bitwise masks. You can minimize, maximize or make the JFrame state to normal, using the JFrame.setExtendedState() method. You can pass the following values as the parameter […]
SERVLET / NOTES</>↗Servlet05 Jun 2012
The ServletContext.getContext(String uripath) enable us to access servlet context of another web application deployed on the same application server. A configuration need to be added to enable this feature. In the example below we will forward the request from the current application to the /otherapp/hello.jsp page. We place a string in the request object attribute […]
JPOS / NOTES</>↗jPOS02 Jun 2012
The code snippet below will show you how to unpack ISO 8583 message. package org.kodejava.jpos; import org.jpos.iso.ISOException; import org.jpos.iso.ISOMsg; import org.jpos.iso.packager.GenericPackager; import java.io.InputStream; public class UnpackISOMessage { public static void main(String[] args) { UnpackISOMessage iso = new UnpackISOMessage(); try { ISOMsg isoMsg = iso.parseISOMessage(); iso.printISOMessage(isoMsg); } catch (Exception e) { e.printStackTrace(); } } priva...
JPOS / NOTES</>↗jPOS02 Jun 2012
The code snippet below show you how to pack an ISO 8583 message. package org.kodejava.jpos; import org.jpos.iso.ISOException; import org.jpos.iso.ISOMsg; import org.jpos.iso.packager.GenericPackager; import java.io.InputStream; public class PackISOMessage { public static void main(String[] args) { PackISOMessage iso = new PackISOMessage(); try { String message = iso.buildISOMessage(); System.out.printf("Message = %s", message); } catch (Exception e) { e.printStackTrace(); } [...