java - What is the most elegant way to hook global variable into JSP (Spring) -
i newbie spring, need simple advice. have footer prints today's date. @ moment use code:
<%@ page import="com.walladverts.helpers.datehelper" %> today <%=datehelper.today()%>
datehelper class returns string, know not elegant use scriplets , mixing logic in view.
what need add hook add variable every jsp page in every action in spring?
i using jstl.
use header
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
get today's date
<jsp:usebean id="today" class="java.util.date"/>
and print using formatter
<fmt:formatdate value="${today}" datestyle="long"/>
it print april 18, 2013
here documentation tag formatdate
Comments
Post a Comment