Tuesday, March 29, 2011

JSP File Naming Conventions

JSP Names

A JSP (file) name should always begin with a lower-case letter. The name may consist of multiple words, in which case the words are placed immediately adjacent and each word commences with an upper-case letter. A JSP name can be just a simple noun or a short sentence. A verb-only JSP name should be avoided, as it does not convey sufficient information to developers. For example:

    perform.jsp

is not as clear as

    performLogin.jsp

In the case of a verb being part of a JSP name, the present tense form should be used, since an action by way of backend processing is implied:

    showAccountDetails.jsp

is preferred over

    showingAccountDetails.jsp

How to handle JSTL tags Errors and exception while iterating






if we use capex.ROWColor means rowcolor declare as uppercase in java beans while iterating in jsp page using the JSTL tags its give exception , so while creating beans need to take care about the name convention in variable declaration in bean

How to read Excel Data (XLS,XLSX)

For both XLS and XLSX format no need to use the HSSF or XSSF package avaliable in POI
,u can make use of org.apache.poi.ss.usermodel for both format with same code no need to write seperately .

It works for both.

How to update Eclipse for SVN or How to use SVN with Eclipse

http://www.ibm.com/developerworks/opensource/library/os-ecl-subversion/

How to get CLOB data extending Spring Stored Procedure interface

declareParameter(new SqlOutParameter(OUT_PARAMETER, Types.CLOB ,null,new SqlReturnType()
{
public Object getTypeValue(CallableStatement cs, int i, int sqlType, String typeName)
throws SQLException
{
try
{
final Clob aClob = cs.getClob(i);
final Reader clobReader = aClob.getCharacterStream();
int length = (int) aClob.length();
char[] inputBuffer = new char[1024];
final StringBuffer outputBuffer = new StringBuffer();
while ((length = clobReader.read(inputBuffer)) != -1)
{
outputBuffer.append(inputBuffer, 0, length);
}
return outputBuffer.toString();
} catch (IOException e)
{
_log.info("Exception in processing the Clob data for retriving ");
throw new SQLException(e.toString());
}

}

}
));

How to convert array to List in Java

String commentArray[]={"1","2","3"}

List commentList=Arrays.asList(commentArray);

Difference between Error and Exception

) An error is an irrecoverable condition occurring at runtime. Such as OutOfMemory error. These JVM errors and you can not repair them at runtime.Though error can be caught in catch block but the execution of application will come to a halt and is not recoverable.


While exceptions are conditions that occur because of bad input etc. e.g. FileNotFoundException will be thrown if the specified file does not exist. Or a NullPointerException will take place if you try using a null reference. In most of the cases it is possible to recover from an exception (probably by giving user a feedback for entering proper values etc.)