Skip to main content

Posts

Showing posts from June, 2010

Simple AJAX [, JSP] Example

You will find many examples to learn how AJAX [Asynchronous Java Script And XML] works, but this one is different. Its one of the best way of using AJAX in web applications. The difference -  many of the examples you find uses Java Script to parse the AJAX response, this example avoids that parsing Java Script and uses JSP to generate the HTML and uses simple Java Script just to make the asynchronous call and show the response. It shows simple way of using JSP and AJAX with as much less Java Script as possible. This article wont go into details of what AJAX is and how to make AJAX calls, it explains one good way among many to use AJAX. Lets get on with it then!
The flow of this example is like this – A simple JSP page where user performs an action [button click in this example] to get list of employees, on this action we’ll make an Asynchronous call to a Servlet which will prepare the dummy employee data and sends that data to a JSP page. This JSP generates the HTML displaying the em…

Eclipse Tips

In few situations, you want eclipse to refresh the project contents automatically. Its might be required when you changed the one/more files of an eclipse project in some other editor and you wanted eclipse to reflect those changes automatically. If you are using version control and when you get latest changes from repository, you want those changes to be reflected on your eclipse. This can be configured in eclipse easily.
Go to Window –> Preferences, in this  window select General –> Workspace from the tree in the left panel. When you select Workspace, you’ll see workspace related configuration options in the right panel. The top section will have three checkboxes, one of them will "Refresh Automatically". Select this checkbox and click OK.
Another feature which could be handy is to see different Icons for different file types like Interfaces, Classes, Abstract Classes, etc. You can set this in Window –> Preferences window. In this window select General –> Appe…

Attaching Source/Java Doc - In Eclipse

Its really simple to attach Source code/Java Doc in eclipse, for a library you are using in your application. Select the project for which you want to do the changes.
Go to Project Menu –> PropertiesSelect Libraries TabSelect and expand the Jar file for which you want to add source code/Java doc.This will show you the options "Source attachment" and "JavaDoc Location".Select "Source attachment" option, this will enable 'Edit' button.Click on Edit button, this will open "Source Attachment Configuration" dialog. Here you need to provide the location of the source code to be attached. You can provide either compressed [jar/zip] file Or directory location of the source code. And after providing the location press OK.
Simple isn't it. For attaching JavaDoc select the option "JavaDoc" instead of "Source attachment" in the above mentioned step, and click on Edit. For JavaDoc you can either provide URL as location Or p…