問題:
spring mvc開發過程中, 經常會給model addAttribute, 然後通過EL在jsp中顯示,比如 ${msg},
但是有時候會出現jsp最後顯示的還是${msg},而不是msg賦值過的。
Spring Controller
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;
public class ABCController extends AbstractController{
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request,
HttpServletResponse response) throws Exception {
ModelAndView model = new ModelAndView("HelloWorldPage");
model.addObject("msg", "hello world");
return model;
}
}
JSP page
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>