Monday, October 18, 2010

Custom event handlers in Java

I came across a good article for understanding Custom Event handling in Java at http://www.javaworld.com/javaworld/javaqa/2002-03/01-qa-0315-happyevent.html?page=1

Give a try... :)

Thursday, December 3, 2009

My own web server

This may sound trivial for my geeky friends.. but it was a great thing for me... :)
I set up a web server on my laptop yesterday night hoping to listen to my personal collection of songs from elsewhere... :P
Here is a good web resource. Give it a shot!!
Getting to learn a lot from my friends these days... so hoping to be actively blogging... :)Hope this continues....

Tuesday, December 1, 2009

comparable or comparator

Comparable or Comparator which of these interfaces to use and when; I had been thinking hard on this for quite sometime and had a discussion with a friend of mine on it..
Well here s the tip: use Comparator Interface when instances of your class can be compared in more than one way, else go with Comparable interface. For eg. Employees of a company can be compared by their name, age, salary, etc... So you could define a comparator for each of these criterions and pass it to the static sort method of ArrayList.
Refer http://onjava.com/onjava/2003/03/12/java_comp.html for more clarity.

Tuesday, October 27, 2009

Using jsp tags in struts

I was trying to understand the usage of jsp tags in struts.
Here are the rules for attribute usage for instance consider the following <jsp:useBean id="mybean" class="com.xxx.yyy.mybeanclass" property="myproperty"
scope="request" >
:
1. id is used to define a bean
2. name is used to refer to an existing bean (the value is either the value of an id attribute in a previous tag, or is found in application, session, request, or page scope)
3. property is used to select a property from a bean
4. scope tells which scope to search for the bean. If scope is not specified then the bean is searched for in page, request, session and application order)

Monday, October 26, 2009

Disabling the use of scriptlets in jsp

The use of scriptlets in jsp can be restricted by making use of <jsp-config> element in web.xml

Refer the following for a sample on how to achieve this.. http://www.java-samples.com/showtutorial.php?tutorialid=548

This can allow best practices to be enforced more easily.

Sunday, October 25, 2009

UnsupportedClassVersionError in Java

Most of you would have come across an error like: java.lang.UnsupportedClassVersionError: Bad version number in .class file
[at java.lang.ClassLoader.defineClass1(Native Method)]

on running a compiled java class file.

This error comes when you compile the java file against one version of jdk and run it on an earlier version of jvm. In essence you can not run .class files that are compiled with a newer version than the JVM.

At Work...

Here starts my new blog which is gonna be the repository of my daily xperiences at work.. the techhy stuff which I come across... :) Hoping 2 b active here...