Browsing All posts tagged under »java«

Java: Tomcat Security Protected Example

July 21, 2010


I am recently attracted to look into the Tomcat security protected example. If you freshly install Tomcat servlet container together with the examples, you will get the examples folder in the webapps directory. After you start your Tomcat server, you should be able to access the examples from http://localhost:8080/examples. This post is going to talk […]

Java: Parse using regular expression

May 20, 2009


Java pattern and matcher under java.util.regex.* is extremely useful to pull a portion of a string that matches with the pattern defined. Java pattern and matcher are also able to parse information from the portion of a string by defining the location of the pattern that contains information. This is the example of the application: […]

Java: Colorful Console using Java Native Interface (JNI)

May 19, 2009


Background First time trying Java Native Interface although I know that it is there for years. The main objective is to make Java command line program to be able to put color attribute at Windows Console. After searching online, I found Real’s How To include the color attribute into Java. Basically, it makes a bridge […]

Java: Bean Descriptor XML for Spring Framework

May 19, 2009


It is necessary for each controller (read as – business service) to be declared as a bean in Spring Framework. Referring to How to create a bean descriptor XML file?, these are the ways to register a controller (read as – service) as a bean: Case 1. The XML Bean Declaration File: <beans> <bean id="helloController" […]

Java: Servlet/JSP Forward or Redirect

May 19, 2009


How to use forward // In Java Servlet requestDispatcher.forward("<server side relative address>"); // In JSP <jsp:forward page=” relativeURLspec” /> How to use redirect response.sendRedirect("<client side access-able address>"); The fundamental difference between forward and redirect is the communication with client, i.e. web browser. In redirect, the server sends a response to the client indicating a new […]