jsp连接到postgresql数据库 [英] Jsp connection to postgresql database

查看:426
本文介绍了jsp连接到postgresql数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个项目,我需要使用jsp连接到postgresql数据库,然后在jsp中显示querry的结果。请知道任何步骤和jsp代码...谢谢

I am doing a project where i need to use a jsp to connect to a postgresql database and then show the results of a querry in the jsp. please can any1telme the steps and the jsp code ...thanks

推荐答案

不要将数据库连接代码放在JSP中。将它放在普通的java类中并测试它是否正常工作。然后在需要显示结果时从JSP调用该Java类。这样你就可以将处理逻辑与表示逻辑分开,从而允许可以轻松阅读的可测试的,可重复使用的代码。
Don''t put the database connection code in a JSP. Put it in a normal java class and test that it works properly. Then call that Java class from the JSP when you need to display the results. That way you separate your processing logic from your presentation logic allowing for testable, reusable code which is also easy to read.


hey thanx的想法,但可以为它编写代码..我有很多错误...非常有帮助
hey thanx for the idea but can write the codes for it .. i hav been getting a lot of errors ...wil b very helpful


展开 | 选择 | Wrap | 行号


这篇关于jsp连接到postgresql数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆