tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Watts <...@cliftonfarm.org>
Subject Invoke methods in EL?
Date Mon, 10 Apr 2017 15:35:45 GMT
Environment: Tomcat 7.0.59; JRE 1.8.0_72

I suspect the answer to my problem is "You can't do that" but here goes:

A simple JSP that tries to get a Calendar instance and outputs the year:

<%@ page language="java" 
    contentType="text/html; 
    charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<body>
	<c:set var="X" value="${ java.util.Calendar.getInstance() }"/>
	<c:set var="Y" value="${ X.get(java.util.Calendar.YEAR) }"/>
	The year is ${ Y }
</body>
</html>

This presents a page that just says "The year is" but no year value.  Is
there some syntactical mojo I'm missing or is my best alternative to
resort to a scriptlet?  

(And for context, I actually want to do something along these lines in a
tag file.)



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message