距離開始搗鼓這個系統9天了,目前框架總算是能運行了,這幾天主要困擾的問題以下:css
1.一開始用的springmvc3和hibernate3整合,可是老是有包不全(hibernate3.jar在maven庫中沒找到,多是別的名字吧),因而改爲spingmvc4和hibernate4版本了。html
2.好不容易搭建完,運行時總是報錯,找不到本身寫的一個過濾器,折磨了我幾天後才發現eclipse中project-clean操做後,就行了(不曉得怎麼回事,求大神指點)java
3.sh3升到sh4版本仍是有不少問題的,不過網上找一下的話仍是好找的,改動也不是很大,好比ajax功能報錯,我參考的這個好了http://www.zuidaima.com/question/2051293900327936.htmweb
具體操做記下,省的原網頁沒了:ajax
經過萬能的stackoverflow解決了問題,不僅是須要加pomspring
<!-- For JSON --> <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-core-asl</artifactId> <version>${jackson.version}</version> </dependency> <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-mapper-asl</artifactId> <version>${jackson.version}</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> <version>2.4.3</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.4.3</version> </dependency>
還須要在applicationContext.xml中增長mvc
<mvc:annotation-driven content-negotiation-manager="contentNegotiationManager" /> <bean id="contentNegotiationManager" class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean"> <!-- Turn off working out content type based on URL file extension, should fall back to looking at the Accept headers --> <property name="favorPathExtension" value="false" /> </bean>
4.登陸頁面圖片等靜態資源顯示不出來,報302錯誤,後來發現由於我加了個本身寫的登陸過濾器,在沒登陸時的靜態資源都給跳轉了,解決方法是在過濾器中加了url地址校驗,在sesson中沒有登陸用戶的狀況下,將含靜態資源信息的url排除掉,不進行跳轉,詳細代碼以下:(不知道是否是能夠經過配置文件跳過這麼麻煩的操做,配置個人DispatcherServlet中的過濾地址寫的是「/」,若是寫成」*.do」就沒這些問題了,可是提交url都得加上個」.do」)app
@Override
public void doFilter(ServletRequest req, ServletResponse resp,
FilterChain chain) throws IOException, ServletException {
HttpServletRequest hsq = (HttpServletRequest)req;
User u = (User)hsq.getSession().getAttribute("loginUser");
String uri = hsq.getRequestURI();
if(u==null&&uri.indexOf("/login") == -1&&uri.indexOf(".css") == -1&&uri.indexOf(".JPG")==-1&&uri.indexOf(".gif")==-1
&&uri.indexOf(".jpg") == -1&&uri.indexOf(".png")==-1&&uri.indexOf("SnowCheckCode") == -1) {
((HttpServletResponse)resp).sendRedirect(hsq.getContextPath()+"/login");
}
chain.doFilter(req, resp);
}
框架
5.運行過程當中報錯:。。。。cannot be cast to javassist.util.proxy.Proxy。。。。 原來是jar包衝突 ,網上看的人家的解決辦法:http://www.cnblogs.com/newsouls/p/3942116.htmleclipse