问题标签 [web.xml]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
553 浏览

spring - ContextLoadListener 和 DispatcherServlet

可以在 web.xml 中同时定义 ContextLoadListener 和 DispatcherServlet 还是它们互斥?

0 投票
1 回答
1314 浏览

java - 如何以编程方式配置 Jetty 以执行 JSP 页面?

我发现了一些关于 Stackoverflow 如何通过编辑在 Jetty 中启用 JSP 支持的提示web.xml

但这可以以编程方式完成,没有任何web.xml
(最好不要为此编写自己的 servlet)

甚至可以在 Jetty中以编程方式启用Jersey 的 REST 服务支持。我不敢相信像 JSP 这样广泛传播的东西这么难......

0 投票
2 回答
6462 浏览

java - 如何使用属性文件在 web.xml 中设置值?

我想知道是否有可能web.xml通过使用属性文件来设置属性。例如 web.xml:

并且application.properties将是:

0 投票
1 回答
16000 浏览

path - 在 web.xml 中设置相对于 WEB-INF 的路径

我想在我的 web.xml 中设置一个相对于 WEB-INF 或 WEB-INF/类的路径。

但是,以下代码(repository.home)似乎在我的 Windows 机器上选择了相对于 c: root drive path 的路径。

0 投票
1 回答
2371 浏览

spring - 在 web 应用程序中找不到 Spring 的 ContentLoaderListener,但在系统类路径中找到

我正在用 Spring 构建一个 GWT 应用程序。我在将依赖项注入到我的一个 Servlet 时遇到了一些问题,因此我试图缩小可能出现问题的范围。

首先,当我的应用程序启动时,我得到:

[WARN] 服务器类 'org.springframework.web.context.ContextLoaderListener' 在 Web 应用程序中找不到,但在系统类路径中找到
[WARN] 添加类路径条目 'file:/home/macarse/.m2/repository /org/springframework/spring/2.5.6/spring-2.5.6.jar' 到此会话的 Web 应用程序类路径有关更多信息,请参阅:file:/home/macarse/tpf/eclipse/plugins/com.google.gwt .eclipse.sdkbundle.2.0.4_2.0.4.v201006301309/gwt-2.0.4/doc/helpInfo/webAppClassPath.html [警告]在web 应用程序,但在系统类路径中找到
[警告] 添加类路径条目'file:/home/macarse/tpf/eclipse/plugins/com.google.gwt.eclipse.sdkbundle.2.0.4_2.0.4.v201006301309/gwt-2.0.4/gwt-dev.jar'到此会话的 Web 应用程序类路径有关其他信息,请参阅:file:/home/macarse/tpf/eclipse/plugins/com.google.gwt.eclipse.sdkbundle.2.0.4_2.0.4.v201006301309/gwt-2.0.4/ doc/helpInfo/webAppClassPath.html 2010 年 7 月 18 日上午 11:07:00 org.springframework.web.context.ContextLoader initWebApplicationContext 信息:根 WebApplicationContext:初始化开始于 2010 年 7 月 18 日上午 11:07:00 org.springframework.context。 support.AbstractApplicationContext prepareRefresh INFO:刷新 org.springframework.web.context.support.XmlWebApplicationContext@16b904d:显示名称 [Root WebApplicationContext];启动日期 [Sun Jul 18 11:07:00 ART 2010];上下文层次结构的根 2010 年 7 月 18 日上午 11:07:00 org.springframework.context.support.AbstractApplicationContext 获得FreshBeanFactory 信息:应用程序上下文的 Bean 工厂 [org.springframework.web.context.support.XmlWebApplicationContext@16b904d]:org.springframework .beans.factory.support.DefaultListableBeanFactory@1a8dfb3 2010 年 7 月 18 日上午 11:07:01 org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons 信息:在 org.springframework.beans.factory.support.DefaultListableBeanFactory 中预实例化单例@1a8dfb3:定义 bean [];工厂层次结构的根 2010 年 7 月 18 日上午 11:07:01 org.springframework.web.context.ContextLoader initWebApplicationContext AbstractApplicationContext 获得FreshBeanFactory 信息:应用程序上下文的 Bean 工厂 [org.springframework.web.context.support.XmlWebApplicationContext@16b904d]:org.springframework.beans.factory.support.DefaultListableBeanFactory@1a8dfb3 Jul 18, 2010 11:07:01 AM org. springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons INFO:在 org.springframework.beans.factory.support.DefaultListableBeanFactory@1a8dfb3 中预实例化单例:定义 beans []; 工厂层次结构的根 2010 年 7 月 18 日上午 11:07:01 org.springframework.web.context.ContextLoader initWebApplicationContext AbstractApplicationContext 获得FreshBeanFactory 信息:应用程序上下文的 Bean 工厂 [org.springframework.web.context.support.XmlWebApplicationContext@16b904d]:org.springframework.beans.factory.support.DefaultListableBeanFactory@1a8dfb3 Jul 18, 2010 11:07:01 AM org. springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons INFO:在 org.springframework.beans.factory.support.DefaultListableBeanFactory@1a8dfb3 中预实例化单例:定义 beans []; 工厂层次结构的根 2010 年 7 月 18 日上午 11:07:01 org.springframework.web.context.ContextLoader initWebApplicationContext DefaultListableBeanFactory@1a8dfb3 2010 年 7 月 18 日上午 11:07:01 org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons 信息:在 org.springframework.beans.factory.support.DefaultListableBeanFactory@1a8dfb3 中预实例化单例:定义 bean [] ; 工厂层次结构的根 2010 年 7 月 18 日上午 11:07:01 org.springframework.web.context.ContextLoader initWebApplicationContext DefaultListableBeanFactory@1a8dfb3 2010 年 7 月 18 日上午 11:07:01 org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons 信息:在 org.springframework.beans.factory.support.DefaultListableBeanFactory@1a8dfb3 中预实例化单例:定义 bean [] ; 工厂层次结构的根 2010 年 7 月 18 日上午 11:07:01 org.springframework.web.context.ContextLoader initWebApplicationContext

那样可以么?

在我的web.xml我有:

有没有办法知道这两个 xml 是否已加载?

0 投票
3 回答
2167 浏览

spring - WEB-INF 之外的 Spring XML 文件

我正在一个使用 Spring 和 GWT 的多模块 maven2 项目中工作。假设我有两个子项目:服务和演示。“service”包含服务的实际实现,“presentation”负责为 GWT 包装它们。

我已经成功加载了 WEB-INF 目录(与 web.xml 相同)中的 Spring XML 文件,但是我遇到了应该从其他模块加载的那些 XML 文件的问题。

我的 web.xml 看起来像这样:

spring-presentation.xml是在演示项目spring-services.xml中,在服务项目中。spring-services.xml文件未加载。我错过了什么吗?

0 投票
2 回答
1134 浏览

spring - 如何使spring4gwt导出超过1个服务?

我成功地按照 GWT 和 spring4gwt 的教程,通过以下配置将 StockWatcher 的演示转换为启用 Spring(3.0) 的服务:

网页.xml:

StockPriceService.java:

春天的 app.xml :

然后,我想添加另一个服务:Chatroom.gwt.xml (rename-to="chatroom"),并希望这两个服务可以组合在一个 webapp 中并由一个 spring4gwt 实例提供服务。

这是我的 ChatService.java :

春天的 app.xml :

至于 web.xml :

问题来了!我不知道如何编写正确的 url 模式让 springGwtRemoteServiceServlet 能够同时收听 /stock/spring/* 和 /chatroom/spring/* ?

StockWatcher 模块是 rename-to="stock" ,因此每个 POST 请求都将发布到 URI "/stock/..." 。聊天室模块是 rename-to="chatroom" ,每个 POST 都会被发布到 URI "/chatroom/..." 。我试图写/*/spring/*,但徒劳无功,两者都不起作用......

0 投票
4 回答
27410 浏览

servlets - 可以使用 web.xml 中的 load-on-startup 在启动时加载任意类吗?

如何在 Tomcat 启动时加载任意类?我看到load-on-startup了文件的标签web.xml,但我可以使用它吗?我应该如何实现我的类?

0 投票
7 回答
68035 浏览

java - Maven:自定义 web-app 项目的 web.xml

我有一个 Web 应用程序 Maven 项目,我想根据正在运行的配置文件自定义 web.xml 文件。我正在使用 Maven-War-plugin,它允许我定义一个“资源”目录,可以在其中过滤文件。但是,仅过滤对我来说是不够的。

更详细地说,我想包括(或排除)整个安全部分,具体取决于我正在运行的配置文件。这是部分:

如果这不容易完成,有没有办法拥有两个 web.xml 文件并根据配置文件选择合适的文件?

0 投票
1 回答
2054 浏览

gwt - 将带有 RPC 的 GWT 部署到 tomcat 的问题(可能是 web.xml 问题)

调试时,我使用 mysql 数据库的 gwt 应用程序在 Eclipse 中正常运行。当我在 tomcat 上运行它时,它会正确显示,但是当我单击一个生成 RPC 的按钮(执行 servlet 并联系数据库)时,我得到一个错误。我检查了我的 tomcat 日志,单击按钮时看到 404 错误:

我猜这是 web.xml 文件和 url 模式的问题。我想我不明白这个 url 模式,它应该指向哪里?

Web.xml:

我的界面有一个注释 RemoteServiceRelativePath("greet"),我认为它是相关的:

我尝试将 url-pattern 更改为我的服务实现 /WEB-INF/classes/com/test/baze/server 的文件夹,但我的应用程序挂起并且没有任何消息。你能帮我改变我的web.xml或某事吗?否则让我的应用程序在 Tomcat 上运行。肿瘤坏死因子。