SupportWriter space ↗
REFERENCE LIBRARY

References from other publishers

Republished articles with source attribution. This collection is separate from Diary Coding’s original guides and does not display ads.

Read original guides → · Editorial policy

FOR YOUR CURIOSITY

Latest notes.

CORE API / NOTES</>↗
Core API07 Dec 2006

How can I get current working directory?

A system properties named user.dir can be used if you want to find the current working directory of your Java program. package org.kodejava.io; public class CurrentDirectoryExample { public static void main(String[] args) { // System property key to get current working directory. String USER_DIR_KEY = "user.dir"; String currentDir = System.getProperty(USER_DIR_KEY); System.out.println("Working Directory: " + currentDir); […]

Wayan · 1 min read
SERVLET / NOTES</>↗
Servlet06 Dec 2006

How do I check if parameter is exists in servlet request?

ServletRequest or HttpServletRequest object has a map object that maps parameter name and its value. By accessing this map we can check if a parameter was passed in servlet request. Let’s see the example below. package org.kodejava.servlet; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOExcepti...

Wayan · 1 min read
SERVLET / NOTES</>↗
Servlet06 Dec 2006

How do I get parameter names from servlet request?

This example show you how to obtain parameter name from servlet request. By calling request.getParameterNames() you will get an Enumeration object by iterating this object you can get the parameter names. package org.kodejava.servlet; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; im...

Wayan · 2 min read
SERVLET / NOTES</>↗
Servlet03 Dec 2006

How do I read request parameter from servlet?

When creating an application with Java servlet most of the time we will work with the request and response object. From the request object we can read the parameter submitted by the user’s browser either through an HTTP GET or POST method. Basically what you need to know is when you try to get the […]

Wayan · 3 min read
CORE API / NOTES</>↗
Core API01 Dec 2006

How do I get a list of country names?

Using the code below you can get a list of country names and its ISO code by using the locale class implementation in Java. package org.kodejava.util; import java.text.Collator; import java.util.*; public class CountryList { public static void main(String[] args) { // A collection to store our country object List<Country> countries = new ArrayList<>(); // Get […]

Wayan · 7 min read
SERVLET / NOTES</>↗
Servlet27 Nov 2006

How do I create a hit counter servlet?

Here we have a simple example of creating a hit counter using servlet. The servlet updates the hits counter every time a page is visited and display the number of hits as an image. The image is generated at runtime using Java’s java.awt.Graphic2D and javax.imageio.ImageIO class. To store the number of visit data we create […]

Wayan · 3 min read
✳

Knowledge grows when shared.

Stay curious. There is always something new to learn.

Explore notes ↗
Putu Adi Guna Permana
ABOUT THE AUTHOR

Dr (C). Ir. Putu Adi Guna Permana, S.Kom., M.Kom., IPM., ASEAN Eng.

Writer and founder of Diary Coding — sharing notes, tutorials, and experiences about programming for anyone who wants to keep learning.