Posts

Showing posts from September, 2010

Increasing JVM heap size for Maven

There might be few instances when you are working on bigger project and it needs to do lot of processing while building/packaging final package of the project. In such projects there are chances that you’ll get JVM heap size error while building maven project. You can change the JVM options for Maven2 by setting following environment properties on your system: Environment variable name: MAVEN_OPTS JVM value: -Xms512m -Xmx1024m (adjust these values based on your project requirement). Hope this will help you!

ServletRequest - some useful features

We play with ServletRequest object every day but there are few things which we usually don't use. One of the nice features of Java servlets is that all of this form parsing is handled automatically. You simply call the getParameter method of the HttpServletRequest , supplying the parameter name as an argument. Note that parameter names are case sensitive. You do this exactly the same way when the data is sent via GET as you do when it is sent via POST . The return value is a String corresponding to the uudecoded value of the first occurrence of that parameter name. An empty String is returned if the parameter exists but has no value, and null is returned if there was no such parameter. If the parameter could potentially have more than one value, as in the example above, you should call getParameterValues instead of getParameter . This returns an array of strings. Finally, although in real applications your servlets probably have a specific set of parameter names they are looking