Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 28th, 2002, 02:59 PM
vpenta vpenta is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: Sacramento
Posts: 3 vpenta User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Any example code for multiple selected values from the list box to bean:

I have my form like:

<form>
<select name="propertyID" size=5 multiple>
<option value="1">some description 1</option>
<option value="2">some description 2</option>
<option value="3">some description 3</option>
<option value="4">some description 4</option>
<option value="5">some description 5</option>
</select>

Submit

</form>

in bean i have getter & setter methods:

now , how can i pass one or more selected values from the list box to the bean

and i have a query like:

strQuery = " select * from propery where propertyID IN(getPropertyID(), getPropertyID(), getPropertyID(),getPropertyID() , getPropertyID())"

I have to pass something like this:

select * from property where propertID IN(1,2,3,4)

now i have one getPropertyID() & setPropertyID() methods
how it is possible to pass same variable to pass the multiple values to the bean ?
Any sample code or example, greatly appreicated.
Thanks in advance.

Reply With Quote
  #2  
Old December 28th, 2002, 04:18 PM
Shocka's Avatar
Shocka Shocka is offline
dont click here
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Posts: 409 Shocka User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 35 m
Reputation Power: 7
i would create a vector call property Id and manipulate that. It would be a whole lot easier

Reply With Quote
  #3  
Old December 30th, 2002, 06:30 AM
bricker42 bricker42 is offline
Moderator =(8^(|)
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2002
Location: Sacramento, CA
Posts: 1,710 bricker42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 38 sec
Reputation Power: 8
Send a message via AIM to bricker42
The request object has a getParameterValues() method that returns an array of Strings. This is how you get form input with multiple values.

Unless having multiple propertyID values is going to be a rare case, I'd suggest you make your bean property a String[]. When you need to pass a single value, you can just pass a String[1] (which you can get from request.getParameterValues() ).
__________________
-james

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > Any example code for multiple selected values from the list box to bean:


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT