aspose file tools*
The moose likes JDBC and the fly likes Database to jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Database to jsp" Watch "Database to jsp" New topic
Author

Database to jsp

divya kundapur
Ranch Hand

Joined: Aug 21, 2007
Posts: 110
I m getting the below data from db table, and i m not able to figure out how to get the first 2 columns data into jsp. The first column values are duplicates and i need to maintain the insertion order .. any help


'July', 1, 'helpdesk'
'June', 1, 'helpdesk'
'July', 1, 'profile'
'June', 1, 'profile'
'August', 2, 'schedule interview'
'July', 2, 'schedule interview'


SCJP - 5.0
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

What have you written so far, or are you just completely stuck?


and i need to maintain the insertion order

You should never rely on the insertion order of a database since this may change. Instead defind an extra field (you could call it creation data) and sort your records on that.


The first column values are duplicates

Do you not have a primary key? If you want to group the same values together SQL has a group by clause that can do it.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
divya kundapur
Ranch Hand

Joined: Aug 21, 2007
Posts: 110
Is there any way i can pass the first 2 column values to the jsp. I m using group by in order to get those 'helpdesk', 'profile' , 'schedule interview' values, and right now I need to display only the month and count for each month in jsp.

Do i have to use seperate sql stmts for 'helpdesk', 'profile' , 'schedule interview'

thanks
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


Is there any way i can pass the first 2 column values to the jsp. I m using group by in order to get those 'helpdesk', 'profile' , 'schedule interview' values, and right now I need to display only the month and count for each month in jsp.

Yes. Have a read of this. It should get you going.


Do i have to use seperate sql stmts for 'helpdesk', 'profile' , 'schedule interview'

No.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30762
    
156

Take a look at the "distinct" keyword for the duplicates.

Also, when you say "database to JSP", I hope you mean Java class. Having JDBC code directly in a JSP is poor practice.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Database to jsp