1.中文顯示亂碼解決-
在web.xml 放入
<filter>
<filter-name>encodingFilter</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>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
2.新增project-
new -> spring legacy project -> spring mvc project
3.做成war檔後,放入tomcat/webapp產生的缺乏jar檔的問題-
在sts專案中,新增對應的WEB-INF/lib folder,放入mysql-connector.....jar等等 ;
等到解war檔的時候,就有對應的lib folder
4.在STS中執行時,於url輸入網址的名稱為pom.xml中的artifactId
ex: http://localhost:8080/springmvc/register
沒有留言:
張貼留言