Posts Under 'Servlet'

How to Increase Heap Size for Tomcat + Windows

Tomcat can be installed in two different ways and below is the information about how to increase or set the heap size for tomcat server in both scenarios – 1. Folder installation – Create one new environment variable JAVA_OPTS – Set following value -Xms256m -Xmx512m – instead of 256m and 512m , you can enter […]

Read more »


Character Conversions from Browser to Database in JAVA

Character Conversions from Browser to Database in JAVA Characters in route to their final storage destination on the World Wide Web, move through various layers of programming interfaces and can cross software and hardware boundaries. This article provides helpful hints and best practices for accurately transporting character data from browser to database and back again. […]

Read more »


The request doesn’t contain a multipart/form-data or multipart/mixed stream, content type header is null

org.apache.commons.fileupload.FileUploadBase$InvalidContentTypeException: the request doesn’t contain a multipart/form-data or multipart/mixed stream, content type header is null If you are iterating the items from the multipart request without checking if an http request is encoded in multipart format then you will get this error. If ServletFileUpload.isMultipartContent(request) returns true then you need to get the fields via the […]

Read more »


Serving Image from Absolute Path in Java/J2EE

import java.io.*; import java.net.URLDecoder; import javax.servlet.*; import javax.servlet.http.*; /** * Serving Image from Absolute Path. */ public class ImageServAbsolutePath extends HttpServlet { private static final long serialVersionUID = 1L; private static final int BUFFER_SIZE = 10240; private String imagePath; public void init() throws ServletException { /*——- Image Base Path ———–*/ this.imagePath = "/images"; } protected […]

Read more »


java.lang.IllegalStateException in Java Servlet

When response.sendRedirect() is not the last statement in Servlet to be executed and its embedded in between your business logic i.e after response.sendRedirect(), if some function or business logic is continued this exception will be thrown by the java servlet. So, it should be the last statement otherwise it should return null after redirecting. eg. […]

Read more »