TAGLIB / CATATAN</>↗Taglib23 Agt 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 / CATATAN</>↗Taglib19 Agt 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> […]
TAGLIB / CATATAN</>↗Taglib17 Agt 2009
The <c:forEach> tag in the core JSTL tag library is a useful tag when we want to iterate over a collection of data such as array. It is commonly used to render a tabular data in our web pages in form of HTML table. In the example below we display a weather data that we […]
BASIC / CATATAN</>↗Basic15 Agt 2009
This example demonstrate how to user enum‘s name() method to get enum constant name exactly as declared in the enum declaration. package org.kodejava.basic; enum ProcessStatus { IDLE, RUNNING, FAILED, DONE; @Override public String toString() { return "Process Status: " + this.name(); } } public class EnumNameDemo { public static void main(String[] args) { for (ProcessStatus […]
BASIC / CATATAN</>↗Basic12 Agt 2009
In order to use a static member of a class in Java we have to qualify the reference with the class name where they came from. For instance to access the PI and abs() from the Math class we should write: double circle = Math.PI * 10; int absolute = Math.abs(-100); For some time you […]
BASIC / CATATAN</>↗Basic07 Agt 2009
This example demonstrate the use of enum ordinal() method to get the ordinal value of an enum constant. package org.kodejava.basic; enum Color { RED, GREEN, BLUE } public class EnumOrdinal { public static void main(String[] args) { // Gets the ordinal of this enumeration constant (its // position in its enum declaration, where the initial […]