aspose file tools*
The moose likes JSP and the fly likes Get table names Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Get table names" Watch "Get table names" New topic
Author

Get table names

Joseph Smithern
Ranch Hand

Joined: Feb 11, 2006
Posts: 89
I am trying to get all table names in MySQL database using Tomcat 5.5 container.




Gives me errors saying:


An error occurred at line: 8 in the jsp file: /num/TableName.jsp
Generated servlet error:
Illegal modifier for the variable con; only final is permitted

An error occurred at line: 8 in the jsp file: /num/TableName.jsp
Generated servlet error:
Illegal modifier for the variable databaseMetaData; only final is permitted
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

Try taking the java scriptlet you wrote and plop it into the middle of a method. You'll find that it's chock full of errors.

The Java you put into JSP scriplets must follow the same rules as "real" Java classes.

Specifically, can you declare public variable insode a java method?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

Why would you be doing something like this in a JSP in the first place?
Joseph Smithern
Ranch Hand

Joined: Feb 11, 2006
Posts: 89
Thanks,

I was trying to learn more about pulling info out of a database.
I will try other things first since this wont work.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

Do yourself a favor and keep the database access in Java classes where they belong... as far away from the UI as they can get.
Rusty Smythe
Ranch Hand

Joined: Aug 09, 2006
Posts: 93

Originally posted by Bear Bibeault:
Why would you be doing something like this in a JSP in the first place?


I vote for the Devil of Cut 'n' Paste or the Bog Monster of Misunderstanding Encapsulation.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

Originally posted by Rusty Smythe:
the Bog Monster of Misunderstanding Encapsulation


Who frequently shows up with his cousin, the Spectre of Premature Optimization.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Get table names