Tuesday, August 13, 2013

Avoid submitting form when enter key is pressed

Sometimes, you have to avoid submitting page when enter key is pressed. You need to add following style to  text box.

<input id="txtName" name="txtName" style="display: none;" type="text" />

Wednesday, August 7, 2013

Struts forward parameters to URL in action class

In some cases, you have to send additional parameters with the action forwarding.
Following code snip can be used to set additional parameters in the action class of the struts. 

ActionRedirect redirect = new ActionRedirect(mapping.findForward(forwardPage)); 
redirect.addParameter("username", "user"); 

redirect.addParameter("password", "PWD");
return redirect;

Tuesday, August 6, 2013

Find files which contains word using Linux command

Following Linux command can be used to find files which contains specific words. For example, if you need to search files which contain word "test", you can use the following command.

find . -exec grep -l "test" {} \;

Thursday, August 1, 2013

Avoid "Grid Layout Exception" in Jasper reports

When it is creating multiple reports by threads in Jasper, you will get "Grid Layout Exception" occurred by the jasper library. To avoid that, you can add the following property to JVM.

JRProperties.setProperty("net.sf.jasperreports.text.measurer.factory", "net.sf.jasperreports.engine.util.JdkGlyphFixTextMeasurerFactory");

How to get Linux bash command list

Type history in the Linux terminal and enter.

This will list all the commands you executed in the bash.