Wednesday, August 24, 2005

Using Ajax in a simple JSF Application - Introduction

I am going to start another tutorial on how to integrate Ajax with JSF soon. This is going to be a very simple JSF application with no GIS component. I hope that this could be of some help to GIS and non-GIS JSF developers alike.
Before I talk about this application, here is a nice article that demonstrates how to create a JSF textbox component with auto-complete feature using Ajax technique:
https://bpcatalog.dev.java.net/ajax/textfield-jsf/design.html

The above article discusses how to build a custom component that manages the necessary javascript code and can be easily used in a web page. I have, however, used a different approach to create a similar text box. It is simpler in a sense that it doesn't require you to create a custom TextBox component. The downside though is you will have to manage the Javascript code in the jsp page on your own. So if you do not mind writing/using the javascript code yourself, then you might want to give this a try.

The application that I will be discussing will have a text box to enter a country name. As you type a new character in the text box, it will dynamically get upto 5 matching country names from the server and list those names for you to choose from. Once the text box has the selected country name and you submit the form, it will give you a brief description of that country.
To accomplish the Ajax protion of the application, I have used the third strategy discussed in the following article:
https://bpcatalog.dev.java.net/nonav/ajax/jsf-ajax/frames.html
If you are a GIS Developer and have gone through my previous discussion on Integrating Ajax with ArcGIS Server, the idea is pretty much the same.

If you would like, you can download this application from here. In order to run this application, simply extract the ajax folder from the zip file, put the JSF jar files in WEB-INF\lib folder and deploy it in a servlet container.

Next time, I will discuss the code behind this application. Stay tuned!!

3 Comments:

At 10:57 PM, Blogger Infactahost.com said...

Hey, you have a great blog here! I'm definitely going to bookmark you!

I have a hosting site/blog. It pretty much covers hosting related stuff.

Come and check it out if you get time :-)

 
At 2:58 AM, Blogger Tony said...

I've really enjoyed reading your blog. Very interesting.

My submit article here site has lots of info pertaining to submit article here.

Come visit sometime :)

 
At 5:35 AM, Anonymous Anonymous said...

I downloaded the application, it worked fine, but when i tried doing some experiment on it, i.e, i moved the country.jsp to a folder under ajax/pages, the drop down worked fine when the page was loaded for the first time but then i got a js error once i clicked on the OK button. i was uable to trace the reason, could you please help me in that.

The structure became like this
ajax
|----index.jsp
|----pages/country.jsp
|----WEB-INF
|----js

 

Post a Comment

<< Home