APACHE COMMONS / NOTES</>↗Apache Commons03 Sep 2009
This example using the Apache Commons FileUpload library to create a simple application for uploading files. The program is divided into two parts, a form using JSP and a servlet for handling the upload process. To run the sample you need to download the Commons FileUpload and Commons IO get the latest stable version. The […]
CORE API / NOTES</>↗Core API30 Aug 2009
The code below helps you find the number of a specified weekday (Monday, Tuesday, Wednesday, etc.) between two dates. The solution we used below is to loop between the two dates and check if the weekday of those dates are equals to the day we want to count. package org.kodejava.util; import java.util.Calendar; public class DaysBetweenDate […]
SWING / NOTES</>↗Swing27 Aug 2009
The Swing javax.swing.Timer object fires the action event after the delay time specified in the constructor passed. For some reasons you might want the Timer class fires immediately after it was started. To achieve this you can set the timer initial delay by calling the setInitialDelay(int initialDelay) method. The example below give you an example […]
SWING / NOTES</>↗Swing25 Aug 2009
In this example you’ll see how to use java.swing.Timer class to create a text clock program. package org.kodejava.swing; import javax.swing.*; import java.awt.*; import java.util.Calendar; import java.text.DateFormat; import java.text.SimpleDateFormat; public class TimerDemo extends JFrame { public static final DateFormat df = new SimpleDateFormat("hh:mm:ss"); public TimerDemo() throws HeadlessException { initUI(); } public static void main(String[] args) { […]
TAGLIB / NOTES</>↗Taglib23 Aug 2009
The <jsp:forward/> tag forward user request to other page. For example, a user request page1.jsp and in this page the server found a <jsp:forward page="page2.jsp"/>. The server immediately stop the processing of page1.jsp and jump to the page2.jsp. Let see an example of using <jsp:forward/> tag. page1.jsp <%@ page contentType="text/html;charset=UTF-8" %> <!DOCTYPE html> <html lang="en"> […]
TAGLIB / NOTES</>↗Taglib19 Aug 2009
The <jsp:include/> tag is use for including another page fragment of a JSP page into another page. This is useful when you have a common page such as header, footer or a menu that applied to many of all of your pages. <%@ page contentType="text/html;charset=UTF-8" %> <!DOCTYPE html> <html lang="en"> <head> <title><jsp:include/> Demo</title> </head> <body> […]