## Some tricks found during Spring/SpringMVC development

2017-09-17

Recently, I am developing a web application with Spring for database course. The reason to choose Spring instead of Rails which I am pretty familiar with or Node.js, is that I would like to have a chance to experience how the Spring frame works. Indeed, the design of Spring frame amazed me. Dependency injection and aspect-oriented programming are good ways to keep the project structure organized. They also help the update in the future.

Back to web development, the structure is pretty similar with Rails. Both use MVC pattern. However, I did encounter some bugs and spend hours to figure them out and fix. I will listed them here.

## unrecognized EL expression

The EL expression in *.jsp file is like \${xxx}, so we could evaluate the expression inside. But sometimes, it just doesn’t work. In order to solve it, put following line in the beginning of the jsp file.

<%@ page isELIgnored="false" %>

## jdbc url

While connecting database as datasource, we may need a jdbc url. The jdbc url has a pattern like jdbc:mysql://host1:port1/db. For example, mine is jdbc:mysql://localhost:3306/course_lookr

## jdbc unrecognized time zone

I had unrecognized time zone problem while trying to connect to local db with mysql-connector-java 6.0.3. We can downgrade it to 5.1.39. Or explicitly specify it in jdbc url appending ?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC"