Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!nuzba.szn.dk!pnx.dk!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Chris Riesbeck Newsgroups: comp.lang.java.programmer Subject: Re: JSTL: getting a map's keys Date: Tue, 20 Mar 2012 12:52:46 -0500 Lines: 29 Message-ID: <9sruffF39oU1@mid.individual.net> References: <9spbepF1baU1@mid.individual.net> <9srshfFjo5U1@mid.individual.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net bhwlpaZydO/pOCOhDeztnw54lc+QqPFfdJgLs+FNKsIm3u6I31 Cancel-Lock: sha1:oQGBDSYBMlqhwjaxm/n8Yez4OY0= User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 In-Reply-To: <9srshfFjo5U1@mid.individual.net> Xref: csiph.com comp.lang.java.programmer:13082 On 3/20/2012 12:19 PM, Chris Riesbeck wrote: > On 3/19/2012 6:59 PM, Daniel Pitts wrote: >> On 3/19/12 11:15 AM, Chris Riesbeck wrote: >>> >>> [summary: rates is an instance of a subclass of Map that >>> implements getKeys()] >>> >>> Why does ${rates.keys} generate nothing in these lines of JSP? >>> >> My guess is that ${rates.keys} is interpreted as equivalent to >> ${rates['keys']}, so it is looking for a key of "keys", not a java bean >> property. Just to nail the coffin lid shut on this. The JSP EL defines name.key as just shorthand for name["key"]. To interpret [] expressions, JSP uses the first answer it gets from this chain of resolvers: ImplicitObjectELResolver registered custom ELResolvers MapELResolver ListELResolver ArrayELResolver BeanELResolver ScopedAttributeELResolver http://docs.oracle.com/javaee/5/api/javax/servlet/jsp/JspApplicationContext.html So the Map interpretation will always override the Bean interpretation.