• Welcome to KonaKart Community Forum. Please login or sign up.
 

any specific reason for two types of coding ??

Started by Sony George, June 15, 2009, 10:57:42 am

Previous topic - Next topic

Sony George

Hello,

This question is to the konakartians,
In NewAddrBody.jsp and EditAddrBody.jsp, you have hard coded the country names,
ie:

<html:option value="1">Afghanistan</html:option>
<html:option value="2">Albania</html:option>
<html:option value="3">Algeria</html:option>
<html:option value="4">American Samoa</html:option>
<html:option value="5">Andorra</html:option>...............

but in RegisterCustomerBody.jsp file you are fetching from the database and displaying...

<html:select name="RegisterCustomerForm" property="countryId">
<html:option value="-1"><bean:message key="register.customer.body.select"/></html:option>
<%com.konakart.appif.CountryIf[] countries = kkEng.getEng().getAllCountries();
if (countries != null)
{
for ( int i = 0; i < countries.length; i++)
{
com.konakart.appif.CountryIf country = countries;%>
<html:option value="<%=Integer.toString(country.getId())%>"><%=country.getName()%></html:option>
<%}}%>
</html:select>

My Question is,
  Is there any specific reason for this ??? fetching from database will minimise the code, and look good..

if this question is foolish, please do forgive...
regars

trevor

The reply may sound more foolish than the question  :)

You can do it either way and so we provide examples of this. In most cases, before going into production, you may want to narrow down the number of countries that you will ship to or that you will accept registrations from so you'll probably end up editing these JSPs.

Note that although the hard coded way has more code and doesn't look as elegant, it does perform a lot better and takes load away from your database. So it's your choice.....

Sony George

Quote from: trevor on June 15, 2009, 11:06:46 am
In most cases, before going into production, you may want to narrow down the number of countries that you will ship to or that you will accept registrations from so you'll probably end up editing these JSPs.


thanks , this is what i wanted ......

that u so much....