Ah, then perhaps that is my issue -- as there is no class that implements it at all. I simply put a HashMap into the model and was attempting to call its get() method directly. Is that not allowed? If not, should I write my own class that implements the Map interface and put that into the model instead?
Thank you very much -- both of you -- for your fast and courteous replies! Nathan Bubna wrote: > > It looks to me like the class that implements the > $pageValues.get("key") method is not declared public. Make sure that > both the pageValues class and the get method therein are both declared > public. > > On Tue, Mar 10, 2009 at 2:36 PM, scadh <sc...@hotmail.com> wrote: >> >> I have a Controller method that returns a ModelAndView. The pertinent >> part of >> the code is: >> >> { >> Map model = new HashMap(); >> model.put("pageValues", contentService.getPageValues(channel, >> landingName).getValues()); >> >> return new ModelAndView("nominate/landing", model); >> } >> >> The getValues() method returns a Map, which I put into the model with key >> "pageValues". >> >> I am unable to directly reference any values in the Map in the view. I >> expected this to work, but it doesn't: >> >> $pageValues.get("key") >> >> However, when referenced indirectly from within a foreach loop, it works >> fine: >> >> #foreach($key in $pageValues.keySet()) >> <li>$key > $pageValues.get($key)</li> >> #end >> >> Is my syntax incorrect attempting to access a Map inside another Map? >> Can't >> seem to figure it out, and time is short! I would greatly appreciate any >> assistance that anyone could provide. >> -- >> View this message in context: >> http://www.nabble.com/Trouble-accessing-Map-values-in-Velocity-tp22444107p22444107.html >> Sent from the Velocity - User mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org >> For additional commands, e-mail: user-h...@velocity.apache.org >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org > For additional commands, e-mail: user-h...@velocity.apache.org > > > -- View this message in context: http://www.nabble.com/Trouble-accessing-Map-values-in-Velocity-tp22444107p22446063.html Sent from the Velocity - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org For additional commands, e-mail: user-h...@velocity.apache.org