Thanks to all that contributed to this, I now have it working due to
the code below.
-----Original Message-----
From: Chris Pratt [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 06, 1999 5:41 PM
To: [EMAIL PROTECTED]
Subject: Re: help with getParameterValues()
OK, here's Programming 101
String tables[]=req.getParameterValues("selectbox name");
boolean addComma = false;
StringBuffer createview = new StringBuffer(); <= More Efficient
for (int i = 0; i < tables.length; i++) {
if(addComma) {
createview.append(',');
} else {
addComma = true;
}
createview.append(tables[i]);
}
and viola, if you use createview.toString() you get "option 1, option
2,
option 3".
(*Chris*)
----- Original Message -----
From: Sam Rose <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 06, 1999 8:17 AM
Subject: help with getParameterValues()
> Hello,
>
> I was wondering if anyone could help me,
>
> I have on one page a select box which the user can choose multiple
> options and then submit this to the next servlet.
>
> This then retrieves the values by this
>
> String tables[]=req.getParameterValues("selectbox name");
>
> My problem is, is that I need to convert these into a string like
> so...
> Option 1, option 2, and option 3
> With the last option not having a comma at the end of it.
>
> I have tried this to get the options
> String createview = null
> for (int i = 0; i < tables.length; i++) {
> createview= createview + tables[i];
> }
>
> Problem is I need a comma to divide the options up but I have no
Idea
> how to do that, as well as making sure there isn't a comma at the
end
> of the last value.
>
>
_______________________________________________________________________
____
> To unsubscribe, send email to [EMAIL PROTECTED] and include in
the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives:
http://archives.java.sun.com/archives/servlet-interest.html
> Resources:
http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
_______________________________________________________________________
____
To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources:
http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html