ParameterList without selection

I have a listbox set to multiple. I can select the lines for deletion from this listbox (via JavaScript). On Servlet side I need all entries of the listbox but I can't get the values from this listbox if the lines are not selected.

This is the way I have done to get the entries:

String[] listvalue = request.getParameterValues("listbox");

[359 byte] By [RC_Germanya] at [2007-11-27 3:03:04]
# 1
and?
calvino_inda at 2007-7-12 3:46:22 > top of Java-index,Java Essentials,Java Programming...
# 2
I need ALL entries of this listbox, but I get only these entries which are marked as "selected"
RC_Germanya at 2007-7-12 3:46:22 > top of Java-index,Java Essentials,Java Programming...
# 3

Thats correct behaviour. The browser will only send the entries in the list box that have been selected. If you always want to get them all then u need to mark them all as selected before you submit the form.You can do this using javascript.

function selectAll()

{

var sel = document.getElementById("yourSelectObjectID");

var opts = sel.options;

for (var i=0; i<opts.length; i++ )

{

opts[i].selected = true;

}

}

or if you want to invert the selections so that those not selected are sent to the server you can do :-

function invert()

{

var sel = document.getElementById("yourSelectObjectID");

var opts = sel.options;

for (var i=0; i><opts.length; i++ )

{

if ( !opts[i].selected)

opts[i].selected = true;

else

{

opts[i].selected = false;

}

}

}

or perhaps you want to send all regardless of whether they are selected or not but also want to know which they selected, so you would need to append something to the selected entries values :-

function mark()

{

var sel = document.getElementById("yourSelectObjectID");

var opts = sel.options;

for (var i=0; i><opts.length; i++ )

{

if ( !opts[i].selected)

opts[i].selected = true;

else

{

opts[i].value = opts[i].value + "_selected";

}

}

}

>

knightweba at 2007-7-12 3:46:22 > top of Java-index,Java Essentials,Java Programming...
# 4
Thank you very much. It works.
RC_Germanya at 2007-7-12 3:46:22 > top of Java-index,Java Essentials,Java Programming...
# 5
You're welcome, remember the dukes.
knightweba at 2007-7-12 3:46:22 > top of Java-index,Java Essentials,Java Programming...