How to implement onchange attribute of list box in jsp

Hi

frndz i am getting a problem in intracting two list boxes in Jsp

what actually i want is that I have two list boxes in a same jsp page

when i select item(sub folders name inside a paticular dir.) from first list box

then i want to show the item(list of files inside the selected folders) in

second list box.

please help me ....how can i implement this ...

regards

thanks as advance

[444 byte] By [kunwar@newgena] at [2007-11-27 8:25:38]
# 1

if you have actionform class, you can get the 1st list box value in the

server side easily. If not you would need to write js funs.

To select a value in a first list box: call this in onChange event in the 1st list box

function getFirstVal() {

var selObj1 = document.getElementById('dirs');

var selIndex1 = document.getElementById('dirs').selectedIndex;

selectedVal = selObj1.options[selIndex1].text;

//assign selectedVal in a hidden val

document.getElementById('hidden1').value = selectedVal;

}

then, in your class:

String firstVal = request.getParameter('hidden1');

if (firstVal != null) {

//code to populate 2nd list box

}

skp71a at 2007-7-12 20:14:42 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

thanks for the reply

but i am not using actionform claasses

i clearify my point again is that

i have these two list boxes in a same jsp page and

when i am accessing a perticular directory .

then in first list box i am showing sub directories list but in second list box i want to show the list of files inside the sub directory which i am selecting in first list box .

i am not able to show the files inside the second list box. please help me for this. problem

regards

kunwar@newgena at 2007-7-12 20:14:42 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...