gpt4 book ai didi

java - gwt-maven-插件 : webapp structure

转载 作者:行者123 更新时间:2023-11-28 22:30:13 26 4
gpt4 key购买 nike

我正在使用 gwt-maven-plugin 和 eclipse 来创建 GWT+Spring webapp。最后,我想将 .war 文件部署到某个应用程序服务器(tomcat 等)。问题是生成的 .war 文件具有奇怪的结构。 enter image description here

然后我在 Tomcat 上运行应用程序不工作 - SimpleGWT.html 页面有一个指向 javascript 文件的链接,它完成了所有工作

<script type="text/javascript" language="javascript" src="SimpleGWT/SimpleGWT.nocache.js"></script>

我的猜测是,由于 SimpleGWT.nocache.js 位于 SimpleGWT 文件夹内,它不在 WEB-INF 内 - 它不可访问有没有办法改变 gwt-maven-plugin 的选项以获得正常的 webapp 结构?这是我的 pom.xml 的一部分

<!-- GWT Maven Plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.6.0</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<!-- Plugin configuration. There are many available options, see
gwt-maven-plugin documentation at codehaus.org -->
<configuration>
<inplace>true</inplace>
<runTarget>SimpleGWT.html</runTarget>
<hostedWebapp>${webappDirectory}</hostedWebapp>
<i18nMessagesBundle>com.javacodegeeks.gwtspring.client.Messages</i18nMessagesBundle>
</configuration>
</plugin>

最佳答案

这个问题主要与访问 HTML 页面中的静态资源有关。

您使用的相对路径有“/”前缀。那是绝对路径指向网络服务器的根目录。

Spring MVC 中,应用程序 org.springframework.web.servlet.DispatcherServlet 负责为 Web 应用程序提供所有内容。

对于上述 servlet 映射,您将什么定义为 url-pattern?请尝试使用 *.html/* 作为 url-pattern

有关更多信息,请阅读 Unable to load java script files in Jetty webapplication .

关于java - gwt-maven-插件 : webapp structure,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22778605/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com