This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes JSP and the fly likes Get table names Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSP
Reply 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: 56196
    
  13

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?


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56196
    
  13

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: 56196
    
  13

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: 56196
    
  13

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
 
Similar Threads
Problem with my jsp compilation/Java mail
How do I implement Connection Pooling with Tomcat 5.0.2.7 and MySQL 4.1
call a simple methode...
How do I solve the problem:Syntax error on tokens, delete these tokens?
custom taglib problem