473,804 Members | 3,757 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting selected values from a select statement

Hi,

I have the following code in the HTML

<select size="1" name="newtitle" >
<% // Need to fill select with available campuses
while (titleit.hasNex t())
{
temp = (String)titleit .next();
// Check if it is the selected campus already
if (temp.equals(ti tle))
{
// Make it the selected campus by default
out.println("<o ption selected>"+temp +"</option>");
}
else
{
// Add it normally
out.println("<o ption>"+temp+"</option>");
}
}

Which just fills up a combo box. Now in the JSP on the submit page I have

String[] titleU = request.getPara meterNames("new title");

If I use following line I get an error...

out.println(tit leU[0]);

Whats the deal??
Tripharn
Jul 17 '05 #1
2 5003
In article <MT************ *******@news-server.bigpond. net.au>,
"Tripharn Teki" <te****@bigpond .net.au> wrote:
Hi,

I have the following code in the HTML

<select size="1" name="newtitle" >
<% // Need to fill select with available campuses
while (titleit.hasNex t())
{
temp = (String)titleit .next();
// Check if it is the selected campus already
if (temp.equals(ti tle))
{
// Make it the selected campus by default
out.println("<o ption selected>"+temp +"</option>");
}
else
{
// Add it normally
out.println("<o ption>"+temp+"</option>");
}
}

Which just fills up a combo box. Now in the JSP on the submit page I have

String[] titleU = request.getPara meterNames("new title");

If I use following line I get an error...

out.println(ti tleU[0]);


This shouldn't even compile. getParameterNam es()
returns an Enumeration, not an array.

If you mean getParameterVal ues(), did you remember
the </select>? You don't show it above.
Jul 17 '05 #2
Yea ooops, it was getParameterVal ues()

But the problem was that in the select statements you need to add
value=blah... which I didn't have...
So essentially in the selectbox you can have someting like Hello World, but
the value can be different, or nothing if you completely miss it out.

Thanks anyway,
Tripharn

"Chris Riesbeck" <ri******@cs.no rthwestern.edu> wrote in message
news:ri******** *************** *****@news.it.n orthwestern.edu ...
In article <MT************ *******@news-server.bigpond. net.au>,
"Tripharn Teki" <te****@bigpond .net.au> wrote:
Hi,

I have the following code in the HTML

<select size="1" name="newtitle" >
<% // Need to fill select with available campuses
while (titleit.hasNex t())
{
temp = (String)titleit .next();
// Check if it is the selected campus already
if (temp.equals(ti tle))
{
// Make it the selected campus by default
out.println("<o ption selected>"+temp +"</option>");
}
else
{
// Add it normally
out.println("<o ption>"+temp+"</option>");
}
}

Which just fills up a combo box. Now in the JSP on the submit page I have

String[] titleU = request.getPara meterNames("new title");

If I use following line I get an error...

out.println(ti tleU[0]);


This shouldn't even compile. getParameterNam es()
returns an Enumeration, not an array.

If you mean getParameterVal ues(), did you remember
the </select>? You don't show it above.

Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
1873
by: middletree | last post by:
I've seen posts here and elsewhere which read something along the lines of "PULLNG MY HAIR OUT!!!!!" or "HELLLLPPP!". Well, I know that kind of subject line isn't descriptive, but I sure can relate right now. I've been struggling for days--days!!-- on this one simple query. I really need to get past this thing and move on. Please help. I have a classic ASP page, and it gives you 4 dropdowns. You can select any or none of them....
4
13656
by: Prashant | last post by:
Hi I have a problem with refreshing of Mviews , I will narrate every thing step by step: 1.create table a (a number); 2.insert into table a values(&a); (after inserting 2 rows and commiting) 3. create MATERIALIZED view b REFRESH WITH ROWID START WITH SYSDATE NEXT sysdate + 2/1440 as select * from a;
2
2763
by: John | last post by:
I have a listbox that is databound when my form loads. A user can then select and option using a drop down box. When the user selects an option the corresponding items in the listbox gets selected. How can I show those selected items at the top of my listbox. The issue is when the user selects an item and it is in the middle of the list, the user is not able to know an item it is selected or not unless they scroll through the listbox.
6
22182
by: George | last post by:
Hi all, How can I get the value stored from the selected item and subitems of a listview? Thanks in advance, George
4
7796
by: planetthoughtful | last post by:
Hi All, I have a relatively simple web user control I've included in a page that simply presents 3 drop down lists and a submit button, that I use as a date picker (ie one list for day, one for month, one for year). I have the control registered on the page and it displays fine, but I haven't managed to work out how to get the value(s) back from the control on clicking the submit button (performs a postback). I want to use the date...
0
1909
by: rich | last post by:
I have a database with 1 to many and the many is a list with multiple selects in a list. When I click on a master record I have as part of my form the select statement for the multiple choice list. I want the list to highlight the multiple chosen values. here is part of the code. $dresscat = specdresscat($dresstypeid); //this is the query to get the values in the detail table $drcatrow = pg_fetch_array($dresscat);// the array for the...
1
9388
by: Mitesh | last post by:
Hi, I have the following HTML code right now. Code: ------------------------------------------------------------------------------------------------------------------------- <td width="20%"><SELECT NAME="cfg_input_global_report_types" MULTIPLE > <OPTION VALUE="BU" >Option1 <OPTION VALUE="BP" >Option2
1
4932
by: raghuvendra | last post by:
Hi I have a jsp page with 4 columns: namely Category name , Category order, Input field and a submit button. All these are aligned in a row. And Each Category Name has its corresponding Category order, Input field and a submit button. The Category name is being fetched from the oracle db along with the corresponding Category order. In the corresponding input field (text box) the user enters a new category order which gets stored in...
9
2631
Catalyst159
by: Catalyst159 | last post by:
I have a form which is used to calculate residential Floor Area Ratio (FAR). The form is structured into seven parts as follows: Part A: Maximum FAR and Floor Area: Part B: Gross Floor Area of the main floors of the main house: Part C: Gross Floor Area of the basement or cellar: Part D: Gross Floor Area of the attic:
1
10317
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10075
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9143
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6851
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5520
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4295
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.