我有以下的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