简体   繁体   English

如何构造多页JSP项目?

[英]How to structure multi-page JSP project?

My Java project has multiple JSP (view) pages, which either insert into or query a database. 我的Java项目有多个JSP(视图)页面,这些页面可以插入数据库或查询数据库。 I created the main page and links to each JSP. 我创建了主页并链接到每个JSP。

I am unsure whether I should put each component of the project (MVC pattern with jsp, servlet, a Java file) into its own web application and its own war file for uploading to the web server. 我不确定是否应该将项目的每个组件(带有jsp,servlet,Java文件的MVC模式)放入其自己的Web应用程序和自己的war文件中,以上传到Web服务器。 Is this a proper way to build my web project? 这是构建我的Web项目的正确方法吗?

If I did this, each component/application would need their own JDBC driver, which seems redundant. 如果这样做,每个组件/应用程序将需要它们自己的JDBC驱动程序,这似乎是多余的。 I could also group the insert pages together in one application and the query pages in another - would that be a better way to proceed? 我还可以在一个应用程序中将插入页面组合在一起,在另一个应用程序中将查询页面组合在一起-这样会更好吗?

I don't see any problem building your war like that, but I prefer using some kind of building tool like Maven, Gradle, etc.. 我没有看到像这样建立您的战争的任何问题,但是我更喜欢使用某种构建工具,例如Maven,Gradle等。

Anyway, If it is a simple dynamic web project with eclipse, you can just put your jdbc driver under your WebContent -> WEB-INF -> lib . 无论如何,如果它是一个带有eclipse的简单动态Web项目,则可以将jdbc驱动程序放在WebContent- > WEB-INF- > lib下

This way, the jdbc driver will be available in your classpath so that basically every java class in your project will be able to use it. 这样,jdbc驱动程序将在您的类路径中可用,因此您项目中的每个Java类基本上都可以使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM