CORE API / NOTES</>↗Core API20 Dec 2006
Formatting how data should be displayed on the screen is a common requirement when creating a program or application. Displaying information in a good and concise format can be an added values to the users of the application. In the following code snippet we will learn how to format a date into a certain display […]
SERVLET / NOTES</>↗Servlet16 Dec 2006
This code helps you to get the physical path where your web application is deployed on the server. It may be useful, so you can for instance read or write files on the server. Please be aware that this method will only work when your web application is deployed in an exploded way, if it […]
CORE API / NOTES</>↗Core API16 Dec 2006
package org.kodejava.util; import java.text.DateFormatSymbols; import java.util.Calendar; public class LastDayOfMonth { public static void main(String[] args) { // Get a calendar instance Calendar calendar = Calendar.getInstance(); // Get the last date of the current month. To get the last date for a // specific month you can set the calendar month using calendar object // calendar.set(Calendar.MONTH, […]
CORE API / NOTES</>↗Core API14 Dec 2006
You want to know what is the last date for a current month. The code below show you how to get it. package org.kodejava.util; import java.util.Calendar; public class LastDateOfMonth { public static void main(String[] args) { // Get a calendar instance Calendar calendar = Calendar.getInstance(); // Get the last date of the current month. To […]
CORE API / NOTES</>↗Core API14 Dec 2006
In the following example we want to get the date of the specified day-of-the-year. We can define a calendar for a specific day of the year by setting the java.util.Calendar object DAY_OF_YEAR field using the set() method. The method take the field to be set and a value. package org.kodejava.util; import java.util.Calendar; public class DayOfYearToDate […]
CORE API / NOTES</>↗Core API11 Dec 2006
package org.kodejava.jndi; import javax.naming.Context; import javax.naming.InitialContext; import javax.servlet.Servlet; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.sql.DataSource; import java.io.IOException; import java.io.PrintWriter; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import...