Why not use some of Javascript's OO features for example ...
// This javascript client side code should be generated from server side
code
// from your data source
var myData = new Array();
myData[0] = new Array();
var myData[0].name = 'Fred';
var myData[0].dob = '05/07/1950';
myData[1] = new Array();
var myData[1].name = 'Susan';
var myData[1].dob = '05/09/1950';
myData[2] = new Array();
var myData[2].name = 'Joe';
var myData[2].dob = '05/08/1950';
You now have a Javascript object (really just an array) with records
containing properties relating to your data.
You can then use a client-side function to populate a drop-down for example
...
function populateDropDown() {
for (var n=0; n < myData.length; n++) {
var newOption = new Option(myData[n].name);
newOption.value = n;
newOption.dob = myData[n].dob;
mySELECTBOX.add(newOption);
}
}
I like this way of doing this and with a small amount of records being
displayed the
amount of content downloaded to the browser is not excessive.
Cheers,
J
-----Original Message-----
From: rohit [mailto:[EMAIL PROTECTED]]
Sent: 23 June, 2000 12:51 AM
To: [EMAIL PROTECTED]
Subject: Re: Design choices: JSP & Javascript
M. Simms wrote:
> Lots of considerations here.......JavaScript can keep your server requests
> lower....
> however, when databases are involved.........unless you can generate
> JavaScript arrays of small size (<200 items) and "pre-load" the HTML with
> the data needed to process the screen, you are talking several server-side
> trips.
>
> JavaScript's only real data repository with any usefulness is arrays.
Could someone please tell me how to "pre-load" HTML files.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.157 / Virus Database: 73 - Release Date: 05/31/2000
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets