Friday, 26 December 2008

How to use tag with tag for dynamic variables

I had a specific requirement in my new project. The business functionality is to develop a simple screen with only 2 set of fields. One field with city name and other a drop down which will have list of country name and the default name in the drop down should be the country in which the city is displayed. The catch is the combination of cities are dynamic and the list of countries are static with almost 500 in the list. We can consider the city name & list of countries as a single row in the screen. I mean there will be that many combination of city and drop down country, be there as many products .


City Name Country Name
Toronto Canada(this is the default from the list of 500)
London UK(this is the default from the list of 500)

For this I have used the following

JSP code


in the form there will be 2 arraylists. citiesArrayList and arrayListOfVOs and getter and setter along with the indexed getter for retrieving the countyVO from the arraylist.

I found this very useful because there is not even a single javascript in the code.
Hope this article will be useful for people who are hesitate to use javascript in their code.

No comments: