• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

What are the demerits of having datbase acces code in jsp?  RSS feed

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,

I am now working on a very old j2ee project where most of the project is developed using only jsp pages.
There are number of SQL query statements and database connection calls in each JSP pages.

now i know that its better to use the servlet's for accessing the DB. what are the demerits of having data access code in jsp, apart from code complexity? does this posses any security issues?

how can i move them in to a properties file?






best regards
vishnu

 
Rancher
Posts: 4686
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure, its not the current style, and the code maintenance issue is well known. But I don't understand your question.

My rule is:

If its ain't broke, don't fix it.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Pat Farrell wrote: If its ain't broke, don't fix it.


...

If you never have to work on the code, that (might) be a reasonable approach. If you do, however, the cost of a naive translation into JSP/Servlets is trivially recovered with the first one or two times you have to deal with the code. IMO just having the ability to have JavaDocs (hence discoverability) is already worth the effort, which is very low.

IMO code like that is broken by definition.

vishnu vyasan wrote: how can i move them in to a properties file?



Move what into property files?
 
When it is used for evil, then watch out! When it is used for good, then things are much nicer. Like this tiny ad:
Programmatically Create PDF Using Free Spire.PDF with Java
https://coderanch.com/wiki/703735/Programmatically-Create-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!