Bear Bibeault

Sheriff
+ Follow
since Jan 10, 2002
Bear likes ...
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
Merit badge: grant badges
Forum Moderator
Bear Bibeault currently moderates these forums:
Biography
Author of:
Secrets of the JavaScript Ninja, 1st and 2nd editions,
jQuery in Action, 1st, 2nd and 3rd editions,
Ajax in Practice, and
Prototype and Scriptaculous in Action
Cows and Likes
Cows
Total received
173
In last 30 days
0
Total given
186
Likes
Total received
4642
Received in last 30 days
0
Total given
2950
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt Green check
expand Greenhorn Scavenger Hunt Green check

Recent posts by Bear Bibeault

Two things:

1. When using regular expressions, it's best to use RE literals versus strings when you can. That way you get syntax checking, and avoid string escaping woes.

2. \s

So:
Then you would use <c:forEach> to iterate over your data.
1 month ago
JSP
That depends on what tag library you are using. It will likely have tags for looping over a list or array of data.
I revised my post. You'd need to loop through your list and create an option element for each choice.
Your HTML for the select element should contain only options elements, and optionally optgroup and hr elements.
P.S. If you want to get fancy with CSS and are targeting only modern browsers, here's an article that might be helpful.
HTML select elements are largely un-stylable. What are you trying to achieve?
Moved to the JSP forum. Please be sure to post JSP questions in the correct forum. Thanks.
3 months ago
JSP
So you're getting the value of the control (seemingly before the options are added?):

and then later try to use this value as the id of the control:

???

That makes no sense to me.
If you look at the generated HTML you should see the problem.












Spoiler:
No quotes around the attribute value so only the first word is parsed as part of the value.
jQuery has no addDefaultText method. Maybe a plugin that's no longer supported?