Posts Under 'Jsp'

File upload using Java

First download Apache Jakarta Commons FileUpload library from this link and add into classpath of your Application. Validate HTTP Request Now that you have installed the FileUpload library, you can start writing the code. First, we have to make sure the HTTP request is encoded in multipart format. This can be done using the static […]

Read more »


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 »


How to remove white-space from a String

/*** replace multiple whitespaces between words with single blank */ String before=" hi how are you "; String value = before.trim().replaceAll("[ ][ ]*", " "); or String value = before.replaceAll("\\b\\s{2,}\\b", " "); //before : hi how are you //after: hi how are you /* remove leading whitespace */ String value= before.replaceAll("^\\s+", ""); //before : hi […]

Read more »