I am using JSPs for the view, and Spring MVC 3.0 for the controller. In my JSP, I want to show the current DateTime, for which I have the following code...
<c:set var="dateTimeDisplayFormat" value='<spring:message code="display.dateFormat" />'/>
<c:set var="currentDateTime"
value='<%= new SimpleDateFormat(${dateTimeDisplayFormat}).format(new Date()) %>'
scope="page" />
Now, the problem is JSTL fails to recognize my nested tag for SimpleDateFormat instantiation. I wish to pass the format string (As obtained from the 'dateTimeDisplayFormat' variable) to the SimpleDateFormat constructor.
Can someone please advice how do I write the nested constructor for SimpleDateFormat in the c:set statement above?
Thanks in anticipation!
PWC6197: An error occurred at line: 27 in the jsp file: /WEB-INF/views/common/header.jsp PWC6199: Generated servlet error: Syntax error on token "$", AssignmentOperator expected after this token Thanks for opening my eyes to the 2nd approach, but with that, the date does now show up on the page, with all my remaining code being the same ie.