One thing I learned today is "there is no selected property in
<html:option>
like plain old option" , we can give value in
<html:select>
that matches the value against each option and if match found marks the option selected.
but I want to make multiple options pre-selected on page load(am using
<html:select multiple="true">
How can it be achieved?
Implement the following:
function callSelectAll(selectName)
{
var i;
for(i=0;i<...) {
document.getElementById(selectName).options[i].selected = true;
}
}
And use String[]
array name as a property name for that html:select
property form bean property. And the name of that array as a property of that html:select
in jsp page.
You will ultimatly gate the all selected values un the that string array of form bean.