If a beginner coder you may get confused by the fact that Date.parse function has been deprecated. Not to worry though, it was deprecated for good reason as the DateFormat classes gives you a better way to convert strings into JAVA Date objects. The DateFormat class contains a parse method that will convert a String…
Java
Code Snippets: Commenting your JSP code
All web developers know that they can add comments to their HTML by use of the <!– –> tag. This causes the contents to not be rendered to the viewer but still displayed in the source of the page. This method of commenting can still be done in JSP but in addition there is the<%–…
Code Snippets: How to get the web application context path from within JSP
Often in JSP we find ourselves creating links to other pages within our web application. The below code allows us to easily get the web application context path from within a JSP file. ${pageContext.request.contextPath} Utilizing JSTL we could also set this value to a variable so that we have a short hand method for getting…
Logging with log4j: How and why you should use logging within your application.
Why should developers use logging? Logging to those new in the development world is the process of putting output statements inside your code to facilitate debugging and analysis of performance or issues. Development of an application is completed by going through a life-cycle that typically includes requirements, code production, testing, and deployment in some manor.…
Java Property Files: A Beginner’s Guide on how to create, load, and use Properties
What is a Property File? A .properties file is a file used to store the configurable parameters of your Java application. The standard format for the Property File is one parameter per line with key value pairs delimited by the equals (=) character. Comments are allowed in the file by placing a # or !…
Java Calendar and SimpleDateFormat Classes: A Beginner’s How To for Date Manipulation
Java Calendar The Calendar class is a java utility for obtaining and modifying the current date and time. It contains all the functionality necessary to get the current time in any time zone as well as methods for manipulating the Date. import java.util.Calendar; Java SimpleDateFormat The SimpleDateFormat is another utility that is used to format…
How to use Spring Framework with a Command Line JAVA Application
What is Spring Spring is an open source framework created with the purpose of enabling developers to build and deliver applications faster. The Framework is available for both the JAVA and .NET platforms. Spring provides a set of core features that can be used for most applications as well as modules that provide additional features.…
Factory Pattern and the Java Class Object
Overview The Factory Pattern is a Software Design Pattern that is used to create an object without calling the specific object’s constructor. This pattern allows a end user to call the factory to instantiate a class without having to know how to instantiate the class itself. How it works is by the creation of a…
Java ArrayList: creating an ArrayList from splitting of a string on multiple delimiters
Overview A common task in various programming languages is to split a string based on delimiter and create a resulting array. In java we sometimes prefer to utilize collections instead of a basic array object, luckily java has the Arrays object that can be used to perform various functions on an inputted array. The Step…
iBATIS Data Mapper
What is iBATIS? iBATIS is a framework that utilize DAO and SQL Maps to create a light weight persistence layer interfaces that allows you as the developer to easily interact with your Database using objects and sql that you write instead of learning complex ORMs such as Hibernate. Simply put iBATIS acts as the mapper…