Java Get ALL elements from a multiselect Box
<p>I have a multi-select Box and Im doing some javascript to sort the order of the elements in the box.  I want to submit the WHOLE array after sorting back to the Java and not just the select items.  How can I achieve this??  thanks</p>

<p>JSP:</p>

<pre><code>&lt;script type="text/javascript"&gt;  
$(document).ready(function()
    {   
$("#mup")[0].attachEvent("onclick", moveUpItem);    
$("#mdown")[0].attachEvent("onclick", moveDownItem);    
});   


function moveUpItem()
{  
$('#list option:selected').each(function()
        {    
    $(this).insertBefore($(this).prev());   
    });  
}   

function moveDownItem()
{    
$('#list option:selected').each(function()
        {    
    $(this).insertAfter($(this).next());   
    });   
}

&lt;/script&gt; 



&lt;table width="100%"&gt;
&lt;tr&gt;

    &lt;td width="50%" align="center"&gt;
        &lt;h1&gt;DET Column Maintenance&lt;/h1&gt;
    &lt;/td&gt;

&lt;/tr&gt;
&lt;/table&gt;


  &lt;form action="process.det_column_order" method="post" name="detColumnSortorder" &gt;
                    &lt;table class="data_table"&gt;
                        &lt;tr align="center"&gt;
                        &lt;td&gt;
                            &lt;select id="list" name="fieldNames" size="35" multiple="multiple" style="width: 250px;"&gt;
                                &lt;c:forEach var="field" items="${detFields}"&gt;
                                &lt;option value="${field.fieldName}"&gt;${field.displayName}&lt;/option&gt;
                                &lt;/c:forEach&gt;
                            &lt;/select&gt;
                        &lt;/td&gt;
                        &lt;tr&gt;
                        &lt;td style="text-align: center;"&gt;
                        &lt;button id="mup"&gt;Move Up&lt;/button&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
                        &lt;button id="mdown"&gt;Move Down&lt;/button&gt;
                        &lt;/tr&gt;
                        &lt;/td&gt;
                        &lt;tr&gt;
                        &lt;td style="text-align: center;"&gt;
                            &lt;input name="action" type="submit" value="Submit"/&gt;
 &lt;/table&gt;   
 &lt;/form&gt;
</code></pre>

<p>FORM:</p>

<pre><code> private String[] fieldNames;
public String[] getFieldNames() { return this.fieldNames; }
            public void setFieldNames(String[] val) { this.fieldNames = val; }
</code></pre>
