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 API27 Jun 2007

How do I insert a string in the StringBuilder?

package org.kodejava.lang; public class StringBuilderInsert { public static void main(String[] args) { StringBuilder alphabets = new StringBuilder("abcdfghopqrstuvwxyz"); System.out.println("alphabets = " + alphabets); // |a|b|c|d|f|g|h|i|…. // 0|1|2|3|4|5|6|7|8|… // // From the above sequence you can see that the index of the string is // started from 0, so when we insert a string in the fourth […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API25 Jun 2007

How do I remove substring from StringBuilder?

This example demonstrate you how to use the StringBuilder delete(int start, int end) and deleteCharAt(int index) to remove a substring or a single character from a StringBuilder. package org.kodejava.lang; public class StringBuilderDelete { public static void main(String[] args) { StringBuilder lipsum = new StringBuilder("Lorem ipsum dolor sit " + "amet, consectetur adipisicing elit."); System.out.println("lipsum = […]

Wayan · 1 min read
SERVLET / NOTES</>↗
Servlet25 Jun 2007

How do I read servlet context initialization parameters?

package org.kodejava.servlet; import java.io.IOException; import java.io.PrintWriter; import java.util.Enumeration; import javax.servlet.Servlet; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet(urlPatterns = "/context-init-param") public class ContextInitParameter...

Wayan · 2 min read
SERVLET / NOTES</>↗
Servlet24 Jun 2007

How do I know session last access time?

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 javax.servlet.http.HttpSession; import java.io.IOException; import java.io.PrintWriter; import java.util.Date; @WebServlet(name = "SessionLastAccessTime", urlPatterns = "/last-access-time") public class SessionLastAccessTime ext...

Wayan · 1 min read
SERVLET / NOTES</>↗
Servlet20 Jun 2007

How do I get a notification when session attribute was changed?

Implementing the HttpSessionAttributeListener will make the servlet container inform you about session attribute changes. The notification is in a form of HttpSessionBindingEvent object. The getName() on this object tell the name of the attribute while the getValue() method tell about the value that was added, replaced or removed. package org.kodejava.servlet; import javax.servlet.annotation.WebListener; import javax.servlet.http.HttpSessionAttributeListener; import […]

Wayan · 2 min read
SERVLET / NOTES</>↗
Servlet19 Jun 2007

How do I capture session creation and removal events?

The Servlet specification define an HttpSessionListener interface that can be implemented if we want to listen to session creation and removal events. The interface has two methods that we can implement, the sessionCreated(HttpSessionEvent event) and sessionDestroyed(HttpSessionEvent event) methods. To activate the listener we need to register it in the servlet container. To register the listener […]

Wayan · 2 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.