aspose file tools*
The moose likes JSP and the fly likes What are the demerits of having datbase acces code in jsp? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "What are the demerits of having datbase acces code in jsp?" Watch "What are the demerits of having datbase acces code in jsp?" New topic
Author

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

vishnu vyasan
Ranch Hand

Joined: May 27, 2008
Posts: 39
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

Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

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.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

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?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: What are the demerits of having datbase acces code in jsp?