• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP MYSQL

 
colm o'donnell
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I was on here yesterday trying to get some help but am still stuck exactly where I was yesterday. I am making a website for football clubs and i have a database witht the following fields:

ClubID
ClubName
ClubManger

On the first page,clubs.jsp, I want there to be a list of clubs names from the database. When their clicked on I want the database to be accessed and the the clubid to be retreived. I then want to be brought to the next page, profile.jsp and display the Club name and manager according to that ClubID. Please Please Please can some one help me with this code Please. I am a complete beginner at JSP so please be gentle.

Thanks,
Colm
 
Tim Holloway
Bartender
Posts: 18417
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, the best thing to do would be to hit your favorite computer bookstore or the public library. Database-connected webapps are not something that can be well covered in a few short paragraphs. Industrial-grade webapps can be very complex.

The one thing I will say is that it's not considered good practice to access databases - or do any other sort of logic processing - directly on a JSP. While it's commonly done on ASPs and in other quick-and-dirty systems like PHP, the intermingling of the data (Model), the page display (View), and presentation interface logic (Controller) does not scale well if you want to produce something that's reliable and easy to maintain.

And since Java and its frameworks tend to require a lot of up-front work, it's usually used for the heavy-duty stuff. Easier to do PHP or something like for lightweight one-off projects, just like Visual Basic vs. C++.

However, if you want to do so: http://www.oracle.com/technology/sample_code/tech/java/codesnippet/jsps/jstlsql.html

Even if you're not using Oracle, this should be a good start - the main difference is that other databases require different connection info.
 
Ed Carrington
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Tim Holloway:
Actually, the best thing to do would be to hit your favorite computer bookstore or the public library. Database-connected webapps are not something that can be well covered in a few short paragraphs. Industrial-grade webapps can be very complex.

The one thing I will say is that it's not considered good practice to access databases - or do any other sort of logic processing - directly on a JSP. While it's commonly done on ASPs and in other quick-and-dirty systems like PHP, the intermingling of the data (Model), the page display (View), and presentation interface logic (Controller) does not scale well if you want to produce something that's reliable and easy to maintain.

And since Java and its frameworks tend to require a lot of up-front work, it's usually used for the heavy-duty stuff. Easier to do PHP or something like for lightweight one-off projects, just like Visual Basic vs. C++.

However, if you want to do so: http://www.oracle.com/technology/sample_code/tech/java/codesnippet/jsps/jstlsql.html

Even if you're not using Oracle, this should be a good start - the main difference is that other databases require different connection info.


I have the same type of project as mentioned by the OP and I am using Java with MVC. I would think MVC is the best way to go on all web projects small or big? Since I started using MVC I think it is the best way to go even on my small projects. I think PHP has several versions of MVC, with one of them called Cake. Also what kind of up front work are you talking about in this statement: And since Java and its frameworks tend to require a lot of up-front work.

Thanks
[ April 12, 2008: Message edited by: Ed Carrington ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!