我有以下的Web應用程序的結構:如何在Spring MVC的應用程序中打開彈出
內addTerminal.jsp
我寫如下:
....
<a href="#" class="open-map" onclick="showMap(55,22)">show map</a>
...
function showMap(lat,lng) {
window.open('map.html?lat='+lat+'&lng='+lng, 'map', 'width=600,height=400');
}
....
但由於客戶端不能訪問到WEB-INF文件夾我看到404點擊時href
你能否建議解決方法如何解決我的問題?
我想我可以把map.html放到webapp文件夾中,但我認爲存在另一個修復。 應用技術堆棧:
Tomcat
+ Hibernate
+ SpringMVC
的web.xml:
<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Spring MVC Application</display-name>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>
org.springframework.web.context.request.RequestContextListener
</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/webContext.xml</param-value>
</context-param>
<!-- Spring MVC -->
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/webContext.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<!-- Spring Security -->
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>charsetFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>charsetFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
你需要一個訪問路徑添加到彈出。將它放入網絡inf中將會導致無法訪問。將它放在webapp目錄中,並確保所有請求都沒有被轉發到spring調度器servlet,而是.html不被調度器處理。或者,將.mtml文件添加一個mvc:資源,然後您可以將它留在web-inf中。 – 2014-10-28 10:16:51
你可以請你發佈你的網頁配置嗎? web.xml或java類取決於您使用的是哪個版本。你也可以發佈你的春季調度xml配置或javaconfig?這樣我可以給你一個你的用例的答案。 – 2014-10-28 10:21:04
@Kevin Bayes主題更新 – gstackoverflow 2014-10-28 10:22:45