创建一个新的 Tomcat Web 应用程序而不是使用现有的 Web 应用程序
我正在寻求有关人们通常何时在 Tomcat 服务器上创建新的 Web 应用程序而不是使用现有应用程序的建议。
我有一个已部署并正在运行的 Web 应用程序。输入域名看到的网站大部分都是静态页面网站,很少有我用struts2搭建的动态页面。
当用户进入会员专区并登录后,就会看到很多会员相关的东西,都是动态的jsp页面。
问题是我应该将会员区页面和服务器代码放入新的 Web 应用程序中,还是仅在现有的 Web 应用程序上构建。如果我创建一个新的 Web 应用程序,是否会使其更加灵活?
I was looking for advise as to when do people generally go about creating a new web application on a Tomcat server as opposed to using an existing one.
I have a web application that is deployed and running. The website that you see by typing the domain name is mostly a static page website with very few dynamic pages that I have built with struts2.
When a user goes into the Member Area and logs in, that is when the user will get a lot of member related stuff, which is all dynamic jsp pages.
The question is should I be putting the member area pages and server code into a new webapp or just build on the existing webapp. If I create a new web application, does that make it more flexible as such?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
两个 Web 应用程序,即使部署在同一服务器上,也不共享相同的类加载器和相同的会话。因此,如果您认为这两组页面是同一个应用程序,从功能角度来看,并且如果您希望在两组页面之间共享会话(只是为了能够,例如,显示“Hello一旦用户通过身份验证,所有页面中都会出现“John”),那么它们应该位于同一个 Web 应用程序中。
相反,如果您希望对两组页面进行不同的身份验证,并且从功能角度来看它们没有任何共同点,则创建两个 Web 应用程序。
根据你在问题中所说的,我认为一切都应该在同一个网络应用程序中。不要出于纯粹的技术考虑而使用两个 Web 应用程序,例如“这些页面是静态的,而这些页面不是”。
Two web apps, even deployed on the same server, don't share the same classloader and the same sessions. So if you think that the two sets of page are the same app, from a functional point of view, and if you want the session to be shared between both sets of pages (just to be able, for example, to display a "Hello John" in all the pages once the user is authenticated) then they should be in the same webapp.
If, on the contrary, you want a different authentication for both sets of pages, and they don't have anything in common from a functional point of view, then make two webapps.
Based on what you said in your question, I think everything should be in the same webapp. Don't use two webapps for purely technical considerations, like "these pages are static and these aren't".