473,394 Members | 1,806 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

load pull down menu on JSP page

jt
I am new to Javascript and I am having problems with loading a pull
down menu.

I get this error:
javax.servlet.ServletException: No data found

It will list the items just fine if I just list the items without
using the select & option tags. I would like to know why I am getting
an error with the following statement:

<select size="1" name="org">
<% while (rs.next()) { %>
<option value="<%=rs.getString("ORG_CODE")%>">
<%=rs.getString("ORG_CODE")%>
</option>
<% } %>
</select>

Thank you.
-jptu
Jul 23 '05 #1
7 4588
jt wrote:
I am new to Javascript and I am having problems with loading a pull
down menu.

I get this error:
javax.servlet.ServletException: No data found

It will list the items just fine if I just list the items without
using the select & option tags. I would like to know why I am getting
an error with the following statement:

<select size="1" name="org">
<% while (rs.next()) { %>
<option value="<%=rs.getString("ORG_CODE")%>">
<%=rs.getString("ORG_CODE")%>
</option>
<% } %>
</select>


Did you try:

<option value="<%=rs.getString('ORG_CODE')%>">

Jul 23 '05 #2
Yes, I've tried it and it didn't work.

thanks,
jptu

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #3
phuong tu wrote:
Yes, I've tried it and it didn't work.


What's the url of the page, or post the relevant code here.

Jul 23 '05 #4
On 7 Apr 2004 18:11:04 -0700, jt <ju**********@yahoo.com> wrote:
I am new to Javascript and I am having problems with loading a pull
down menu.
OK...
I get this error:
javax.servlet.ServletException: No data found

It will list the items just fine if I just list the items without
using the select & option tags. I would like to know why I am getting
an error with the following statement:

<select size="1" name="org">
<% while (rs.next()) { %>
<option value="<%=rs.getString("ORG_CODE")%>">
<%=rs.getString("ORG_CODE")%>
</option>
<% } %>
</select>


....but I don't see how this is related to JavaScript. You're problem is
with JSP.

You can find the JSP support forums at:

<URL:http://forum.java.sun.com/forum.jsp?forum=45>

Good luck,
Mike

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 23 '05 #5
In article <6f*************************@posting.google.com> ,
ju**********@yahoo.com enlightened us with...
I am new to Javascript and I am having problems with loading a pull
down menu.

I get this error:
javax.servlet.ServletException: No data found
Probably because your query isn't returning any data, but something
expects it to.


It will list the items just fine if I just list the items without
using the select & option tags. I would like to know why I am getting
an error with the following statement:

<select size="1" name="org">
<% while (rs.next()) { %>
<option value="<%=rs.getString("ORG_CODE")%>">
<%=rs.getString("ORG_CODE")%>
</option>
<% } %>
</select>


You have no code here as to what to do if there is no rs.next() - that
is, if the query returns no rows. If it returns no rows, you get an
empty select element. That might be mucking up other code that assumes
there is data in the select element.
Add code that counts how many rows are returned, then check that and
throw an error or something to handle 0 rows.
--
--
~kaeli~
Dancing cheek-to-cheek is really a form of floor play.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #6
Thanks for all your inputs. Sorry, I should have posted this under
java. I found 2 tips to make it work.

1. I changed my select statement from "select * ..." to "select ORG_CODE
..."
2. I assigned the data pulled from recordset to a variable before
inserting it to the pull down.

here's the revised version:
<select size="1" name="org">
<%
String org = null;
while (rs.next())
{
org = rs.getString("ORG_CODE"); %>
<option value="<%=org%>">
<%=org%>
</option>
<%
} %>
</select>


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #7
In article <40*********************@news.frii.net>,
ju**********@yahoo.com enlightened us with...
Thanks for all your inputs. Sorry, I should have posted this under
java. I found 2 tips to make it work.

1. I changed my select statement from "select * ..." to "select ORG_CODE
.."
2. I assigned the data pulled from recordset to a variable before
inserting it to the pull down.


You might also want to do something special in case the org code is
null, if null values are allowed. Otherwise it just prints out the
string "null", which might not be what you want.
--
--
~kaeli~
The more ridiculous a belief system, the higher probability
of its success.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #8

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

Similar topics

1
by: Phillip Russell | last post by:
Is there a way for PHP to see what is selected in a pull-down menu. So that i can use a switch statement to display certain information. If not how can I combine javascript with it to work.
5
by: Glenn Mulno | last post by:
Hi, I am trying to create a report page for several teams. Each team runs the same reports but the reports use different values. For a while this was getting insane everytime I updated the...
1
by: NEUE | last post by:
Hello, I'm trying to have a layer appear on top of a simple pull-down menu, but in IE6 the pull-down menu always appears on top. Even if I put the pull-down in a layer under the other layers, it...
5
by: judiphuongtu | last post by:
I am trying to create an input form with a pull-down menu that allows a user to add an item to the pull-down. I don't want the page to refresh when I refresh the pull-down since there's entries on...
2
by: Keith Burns | last post by:
Hi, I have seen two entries in the archives for this topic: 1. Uses hypertext, not a pulldown menu to feed parameters back to the python CGI 2. The other actually used Java. Is there a way...
1
by: dkimbrell | last post by:
Hi there, I'm very novice to web design. I'm trying to make a pulldown menu, but the formatting keeps getting screwed up when you roll the mouse over it. Please see www.boundarysys.com for...
4
bats fur eels
by: bats fur eels | last post by:
Hi, I was hoping if anyone knew if it were possible using HTML or other basic scripts that enable you to lets say, scroll the webpage down a few margins upon load of page or script. So that it will...
21
by: giandeo | last post by:
Hello Experts. Is it possible to retrieve the value from a populated pull down menu from a database and then use that value to access the same database to get the related fields. Example: ...
5
by: giandeo | last post by:
Hello Experts. Could you find a solution for this problem please! I have the following tables in Access Database Table Name: origin Fields Names: country, countrycode Table Name: make...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...

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.