如何部署 Web 应用程序
我在 eclipse 中创建了一个动态 Web 项目,其中包括 jsp 页面和 servlet。该应用程序的后端是 Mysql,我在 lib 文件夹中包含 mysql-connector-java-5.1.15-bin.jar。我想使用 Tomcat 服务器部署此 Web 应用程序,而不是使用 tomcat 在 eclipse 中运行此应用程序。怎么可能?任何人都可以建议任何示例代码或方法来解决这个问题。
I have created a dynamic web projects in eclipse which includes jsp pages and servlet.The back end of this application is Mysql and i include mysql-connector-java-5.1.15-bin.jar in the lib folder. I want to deploy this web application using Tomcat server instead of running this application in eclipse using tomcat. How is it possible?. Can any one suggest any sample codes or methods to solve this problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
将 WAR 文件复制到 Tomcats webapps 文件夹,它应该会自动部署。威尔·哈同的回答是正确的
copy the WAR file to Tomcats webapps folder and it should auto deploy. answer by Will Hartung is correct
您需要构建一个 war 文件(或ear,具体取决于您使用的技术),然后将其部署到容器中。 (我相信在
tomcat/webapps
文件夹中)。 Ant 和 Maven 这两种流行的项目管理技术都支持这样做。网络上也有大量文档http:// /www.vaannila.com/ant/ant-sample-build-file-war-1.html
you need to build a war file (or ear depending on which technologies you use), and then deploy that to your container. (in the
tomcat/webapps
folder i believe). Ant and Maven, two popular technologies for managing a project, both support doing this. There is plenty of documentation on the web as wellhttp://www.vaannila.com/ant/ant-sample-build-file-war-1.html
步骤1:进入Windows>显示视图>其他>选择服务器
步骤 2:在“服务器”选项卡中。右键单击>添加新服务器>添加运行时(如果不可用)并添加 tomcat 服务器。
第 3 步:将您的项目添加到其中并完成。如果您在“服务器”选项卡中看到,您将看到您的项目。
步骤 4:右键单击服务器并选择调试或运行。
Step 1: Go to Windows > SHow View > Other > Select Servers
Step 2: In Server Tab . Right Click > Add New Server > Add Run time if not available and add tomcat server.
Step 3: Add your project to it and finish. If you will see in Server tab, you will see your project.
Step 4: Right click on server and choose either debug or run.
您可以通过从 Eclipse 运行该脚本来使用 ant 构建脚本,您的 Web 应用程序将自动部署到您的 tomcat 中。另一种选择是将 war 文件复制到 tomcat 的 webapps 文件夹中
You can use ant build script by running that script from your eclipse your web application will automatically deploy into your tomcat. Another one option is to copy the war file into the tomcat's webapps folder
将应用程序从 Eclipse 导出到 .WAR 文件后,您可以在 Tomcat Web 应用程序管理器面板上部署、取消部署和重新加载它: http: //本地主机:8080/manager/html。
After export your application from Eclipse to .WAR file you can deploy, undeploy and reload it at Tomcat Web Application Manager Panel: http://localhost:8080/manager/html.