I've been reading docs and tutorials about spring (3.0), so I've learnt how to return a ModelAndView
with the JSP name and a Map as the model. I've learnt also that in a JSP, if you want to access one key of that map you do ${attributename}
and so on. That's JSP EL. Now my questions:
PageContext
? I tried to find those keys in PageContext.getAttribute
but they are not there.Feel free to add resources to clarify my ideas
When you do something like ${attributename}
, JSP EL will check a variety of sources to find it, including the page and request contexts (in that order).
When your Spring controller returns a model (e.g. inside the ModelAndView
), this model is decomposed by Spring's AbstractView
class and inserted into the request context (this is the "magic" part), so that when your JSP EL expression refers to an item from the model, it's available to be used.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With