This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
In Eclipse a choosed new -> Dynamic Web Project. Then I selected tomcat (as runtime) and jdk. Next, created a jsp file, named index.
I want, to connect to MySQL, and retrieve the data. I have already created a table named "catalog" under a database named "catalog" and filled it with data. Table columns are id(int), name (varchar), location (varchar) and marker(boolean). When are run it , i get on the browser screen only "Test!". Why it doesn't print "Int01" value ?
I'll appreciate any help. Thnx in advance.
P.S: Sorry for my english.
Some best practices:
1) It is better not to have Java code, especially JDBC, in a JSP. It is harder to read/debug/maintain. JSPs are meant for display logic. Search for MVC to see what you should to instead.
2) The result set/statement/connection should be closed in a finally block in case there is a database error.
3) Variable names being with lowercase in Java so "Int01" should be "int01". Or better still "id" so someone reading the code knows what it is.
On your actual question, is there an error message in the system error logs? There should be if the code is throwing an exception.