473,320 Members | 2,111 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,320 software developers and data experts.

generating menu from DB in jsp

waa
Hi,
I want to generate a side menu from a database list and sort it
alphabetically.
I am not please with what i get which is NOT alphabetical.
Below are my codes:
--------BEAN-------------------------------------
public static void loadAllCategories() throws ProductActivityException
{
if (allLoaded) return;
Category cat = null;
try
{
dbConn = ConnectionFactory.getConnection();
if(dbConn == null)
{
System.out.println("Couldnt get DB Connection");
throw new CustomerActivityException();
}
PreparedStatement pstmt
=dbConn.prepareStatement(sql_bundle.getString("fin dAllCats"));
ResultSet rs = pstmt.executeQuery();
while (rs.next())
{findCategory(rs.getString("CATEGORY_NAME")); }
rs.close();
pstmt.close();
}
catch (Exception e)
{
System.out.println("Error during loadAllCategories");
e.printStackTrace();
throw new ProductActivityException();
}
finally
{
try { dbConn.close(); }
catch (Exception e) { System.out.println("Error during
releaseConnection");}
}
allLoaded = true;
}
-------------------------JSP------------------------------------------------
<%
Category.loadAllCategories();
Iterator it = Category.getCategories().iterator();
while (it.hasNext())
{
String catName = (String) it.next();
%>
<a class="menuleft" href="Category.jsp?category=<%= catName %>">
<%= catName %>
</a>
<br>
<%
}
%>
------------------DB------------------------------------
SELECT CATEGORY_NAME FROM CATEGORY ORDER BY CATEGORY_NAME ASC;
The reult I get from this in MySQL is satisfactory. But JSP displays
it differently.

Anyone there with an idea.Thanks.
Jul 17 '05 #1
0 1691

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

Similar topics

10
by: Al Christoph | last post by:
Please forgive me if this is the wrong place to post this. The last place I posted got me a fairly rude response. I guess vb.db people just don't want to think about XML as database. At any rate,...
2
by: google.groups.tr | last post by:
I have an Access 97 database that has a routine to generate a unique report as a PDF file and email it to one person, and loops about 300 times. Each instance through the loop uses a registry...
1
by: Andy Fish | last post by:
Hi, In my aspx web application, I am generating a list of items in a menu down the left-hand side. Different items in the list may have different controls in, and this is data-driven at runtime....
3
by: Anthony | last post by:
Hi There When trying to add a dataset to a web form I get the following error msg. "There were problems generating . To resolve this problem build the project, fix the errors and generate...
1
by: Noor | last post by:
Hi all I need to generate xml schmea for a stored procedures to use with crystal reports tell me any quick and easy method. thanks
2
by: Sen | last post by:
Is there any source code/demo/sample to generating menu in MDI form at runtime ? I did tried to code myselft but very confusing haven't success yet. Sen TIA
4
by: Bill J | last post by:
Hi Everyone, Is there a way of generating a keyboard character event and sending it to a control on a form? For example, if I have a menu item called "Delete", I would like to send a DEL...
1
by: poppy | last post by:
I have an application which has a MDI parent form and a simple menu bar. Using reflection I can get access to other assemblies and add an item to my parent menu which when clicked opens up the main...
4
by: Rob Kerr | last post by:
Hi, After a quick Google turned up very little of use, I've turned to here. The question: has anyone tried to (or more usefully, succeeded in) generating CSS files from an XML document...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.