有没有办法进行“xcopy 部署”? JSP 的?

发布于 2024-08-05 13:09:07 字数 411 浏览 1 评论 0原文

IIS / ASP.NET 环境的优点之一是能够进行“xcopy 部署”——您实际上可以将一堆 .aspx 页面放入 Web 共享目录中,ISS 将弄清楚如何将它们展示到网络上。

有没有办法用 JSP 做类似的事情?

所讨论的确切用例是这样的:我们有一个内部开发/调试工具,如果它只是一个或两个位于 Web 服务器“后台”的 JSP,那么它会工作得更好。

为单个 JSP 创建 JAR 和/或 WAR 文件的整个过程似乎有点大材小用,设置整个 ant 构建/部署任务也是如此。有什么方法可以将服务器指向其中包含 JSP 的目录并让它显示这些内容吗?

(郑重声明,我们使用 JBoss 作为我们的 Java Web 服务器,因此首选解决方案,但由于这个特定难题的性质,我将采用您可能想到的任何可在 Windows 上运行的 Java 服务器。)

One of the things that's neat about the IIS / ASP.NET environment is the ability to do an "xcopy deployment" - you can literally just drop a stack of .aspx pages in a web-shared directory, and ISS will figure out how to show them to the web.

Is there a way to do something similar with JSPs?

The exact use case in question is this: we have an internal development/debugging tool that would work much better if it was just a JSP or two living on the "back burner" of the web server.

The whole process of creating a JAR and/or WAR files for a single JSP seems like overkill, as does setting up a whole ant build/deployment task. Is there any way to just point the server at a directory with JSPs in it and have it show those?

(For the record, we're using JBoss as our java web server, so solutions with that would bve preferred, but due to the nature of this particular puzzle I'll take any windows-runnable java server you might have in mind.)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

遗弃M 2024-08-12 13:09:07

这几乎是 xcopy :-)

如果你确实在 JSP 中拥有了所需的一切(这远非理想,但这超出了这个问题的范围),唯一缺少的部分是位于 WEB- 中的应用程序描述符INF/web.xml。

在最简单的场景中,您需要的只是根 web-app 元素:

<web-app xmlns="http://java.sun.com/xml/ns/javaee"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
   version="2.5"> 
</web-app>

如果您使用任何标记库,您还需要将它们的 URI 映射到本地位置。您可以将所有 JSP 文件与此 WEB-INF/web.xml 一起复制到 servlet 容器的 webapps 位置的子文件夹中,并假设它可以自动检测/部署webapps(大多数都是这样)你就准备好了。

It's almost xcopy :-)

If you truly do have everything you need within your JSP (which is far from ideal but that's outside the scope of this question), the only missing piece of the puzzle is application descriptor located in WEB-INF/web.xml.

And in the simplest scenario, all you need to have within it is root web-app element:

<web-app xmlns="http://java.sun.com/xml/ns/javaee"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
   version="2.5"> 
</web-app>

If you're using any tag libraries, you'll also need to map their URIs to their local locations. You can xcopy all your JSP files along with this WEB-INF/web.xml into a subfolder of webapps location of your servlet container and, assuming it can automatically detect / deploy webapps (majority of them do) you're all set.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文