View Full Version : Help-Inserting the data from Multi Select List box..

05-13-2008, 11:01 PM
Can Someone help me with this.
Only one value is inserted into the Db when I tried
to use the multiselect listbox and selected multiple values.

I need all the values I select from a listbox to be comma separated and
inserted in the coresponding Db column.

I'm using the java for inserting the data into database.

I've the following:

on Jsp I've like this

<html:select property="vpmoPmt" size="4" multiple="true" tabindex="3" >
<html:options collection="pmtlist" property="value" labelProperty="label"/>

On the Form I've the variable defined like this..

private String vpmoPmt[];

In the java code I'm doing this to set the value to insert the data into database table.

String[] vpmoPmt = requestForm.getVpmoPmt();

if (vpmoPmt != null && vpmoPmt.length > 0 ) {

StringBuffer pmt = new StringBuffer();

for ( int i = 0; i < vpmoPmt.length; i++ ) {

if ( pmt.length() > 0 ) {

pmt.append(", ");



Please advise me if I'm doing any thing wrong..


05-14-2008, 06:53 PM
does it work? what errors do you get?