• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cannot resolve type in jsp

 
c york
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Need help. The code that I am getting this error, worked before and now the error String literal cannot be resolved is appearing for Connection, the catch statement, Statement and ResultSet. I do not understand the error.


[BPSouther: Added code tags]
[ July 03, 2007: Message edited by: Ben Souther ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64959
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First and foremost, you shouldn't be doing Java in the JSP, let alone SQL statements. It flies in the face of all that is considered good practice.

The first part of your solution should be to factor out the Java from your pages into Java classes.

That said, we can't help you solve this issue without the exact error message that you are getting.
 
c york
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am a JSP/Java beginner and trying to learn as I go.

The exact error message is - Multiple annotations found at this line(Connection conn.....) Conn cannot be resolved, Connection can not be resolved to a type.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64959
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by c york:
I am a JSP/Java beginner and trying to learn as I go.


All the more reason not to learn the wrong way to do things in the first place!

So, step 1 is to remove the Java from the JSP and get it working in a bean that is independent of the JSP page.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18212
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like the error is due to not having imported the java.sql.Connection class.

That said, Bear is right. JSPs should not be written as though they are ASPs with the logic, the persistence and the view all jumbled together in the same file. That's OK for the quick-hack Microsoft world, but the reason to use J2EE is that it provides a more scalable, more secure, and generally higher-performing platform in exchange for the added complexity that it demands.

If you're learning JUST to do JSPs as imitation ASPs, you're missing the forest while concentrating on the trees.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic