【发布时间】:2013-03-18 13:16:10
【问题描述】:
在上一个问题Forcing JBoss AS 7 to use static files from source (development) directory in Spring project 中,我要求提供 JS/CSS 文件,经过 4 小时的文档阅读和实验,我自己解决了问题。
但我不熟悉 Spring/Servlet 的内部机制来强制 Spring 使用本地文件系统路径(开发文件)中的 JSP 文件。我试试:
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="file:/home/user/devel/app/src/main/webapp/WEB-INF/jsp/"/>
<property name="suffix" value=".jsp"/>
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
</bean>
但是当我访问应用程序页面时出现错误:
HTTP Status 404 - /app/file:/home/user/devel/app/src/main/webapp/WEB-INF/jsp/index.jsp
我认为它来自ServletContext.getRealPath...
我的目标是缩短编辑-部署-测试周期。
请不要建议 JRebel 或 DCEVM 或其他解决方案。直接回答...
【问题讨论】:
-
不应该是
file:///吗? -
我尝试了同样的错误。