1.比较好的连接: 实现传统的ws
http://blog.csdn.net/rongbo_j/article/details/50983716
2.配置spring-mvc时出现的问题以及解决方案
一.所有的jsp需要使用basePath
a.,写一个common.jsp,内容为:
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath();
request.setAttribute("contextPath",basePath);
b.然后在web.xml中加上配置,在加载所有jsp之前先加载common.jsp
<jsp-config>
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
<include-prelude>/WEB-INF/jsp/common/common.jsp</include-prelude>
</jsp-property-group>
</jsp-config>
c.因为当前的的目录结构是 common.jsp在WEB_INF/common/中,需要配置对静态资源的访问,否则不能访问。在spring-mvc.xml中增加配置:
<mvc:annotation-driven/> //必须加上,否则不能访问controll
<!--配置静态资源-->
<mvc:resources mapping="/js/**" location="/WEB-INF/js/"/>
<mvc:resources mapping="/jsp/**" location="/WEB-INF/jsp/"/>
<mvc:resources mapping="/css/**" location="/WEB-INF/css/"/>
<mvc:resources mapping="/images/**" location="/WEB-INF/images/"/>