我目前正在处理涉及Apache Tiles的项目,但遇到以下问题。
项目文件夹的路径名中有(一个或多个)空格。现在Apache Tiles +文件夹路径中的空白处
C:\Users\MyUsername\Documents\Dropbox\Subfolder\My Projects\GymApp
,出乎我的意料,当我使用Apache瓷砖它试图从以下位置加载tile-definition.xml
:
C:\Users\MyUsername\Documents\Dropbox\Subfolder\My%20Projects\GymApp\src\main\webapp\WEB-INF\configurations\tile-definition.xml
所以,问题出在哪里工具X会尝试所有转换部分空白到%20(URL编码),其中工具X是:Windows,Java,Tomcat,Spring或Apache Tiles。由于此Apache Tiles无法加载文件,因为该文件不存在(如果我尝试在Windows资源管理器中打开URL,它会给我提供该文件不存在的错误,同样的事情显示在我的IDE的控制台日志中)。
至于我的问题,是否有可能在包含空格的文件夹中运行Apache Tiles项目?如果是这样,这是如何完成的?
注意*:如果我将My Projects
的文件夹名称更改为My_Projects
,项目运行时没有任何错误,所以我知道文件夹路径在这里有问题。
- 编辑 -
我使用此代码来配置tilesConfigurer
<bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.tiles3.TilesView" />
</bean>
<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">
<property name="definitions" value="/WEB-INF/configurations/tiles.xml" />
</bean>
- 编辑2 -
这是我的IDE日志显示:
DEBUG BaseLocaleUrlDefinitionDAO:154 - File Resource file:/C:/Users/MyUsername/Documents/Dropbox/Subfolder/My%20Projects/GymApp/src/main/webapp/WEB-INF/configurations/tiles.xml at file:/C:/Users/MyUsername/Documents/Dropbox/Subfolder/My%20Projects/GymApp/src/main/webapp/WEB-INF/configurations/tiles.xml not found, continue
DEBUG BaseLocaleUrlDefinitionDAO:154 - File Resource file:/C:/Users/MyUsername/Documents/Dropbox/Subfolder/My%20Projects/GymApp/src/main/webapp/WEB-INF/configurations/tiles_en.xml at file:/C:/Users/MyUsername/Documents/Dropbox/Subfolder/My%20Projects/GymApp/src/main/webapp/WEB-INF/configurations/tiles_en.xml not found, continue
DEBUG TestDispatcherServlet:938 - Could not complete request
javax.servlet.ServletException: Could not resolve view with name 'home' in servlet with name ''
我也遇到了这个问题。你找到了解决这个问题的方法吗? – jonasespelita
@jonasespelita不幸的是,我'固定'它没有使用任何空白的路径。 –