Eran Medan Eran Medan - 1 month ago 4x
Java Question

JSP 2.2 EL it keyword in Jersey Viewable - where is it documented?

I've found out that if I have a

(jersey) passing a model to a JSP, then the way to access it is by prefixing the map key with



<h2>Hello World ${}!</h2>

The JAX-RS resource method:

public Viewable index(@Context HttpServletRequest request) {
System.out.println("/INDEX called");
HashMap<String, String> model = new HashMap<String, String>();
return new Viewable("/index.jsp", model);

I was basing on this resource:

but I was wondering, what is
and where does it come from, is it specific to Jersey? if so where is it documented (it's hard to search for "it" as google tends to removes it from the search, no pun intended)

Could not find any mention of it in the Java EE documentation.


In sections 17.4 of this documentation. It states:

Jersey will assign the model instance to the attribute named "it". So in the case of the implicit example it is possible to referece the foo property on the Foo resource from the JSP template as follows:


So it is just a Jersey specific model attribute. Since it's a model attribute, at some point before the view gets rendered, it gets added to request attributes. It can then be accessed with the EL accessor ${}. If it was named jerseyGuy, you would access it as ${jerseyGuy}.

EL, which resolves ${...} expressions, uses PageContext#findAttribute() to resolve the attribute name to some attribute in the page, request, session, or application context.