Now if we talk of scritpless jsp how would we be replacing the above script code? To avoid using scriptlets that is.
In short... you can't very easily. As far as I know, there are no standard tags for populating a map (and aside from <jsp:useBean>, which should be avoided here, there's no way to create a new HashMap instance either). This is mainly because the Map isn't a JavaBean. You can only use <c:set /> to replace the very last line of your example, where you set the page-scoped attribute called "movieMap".
You could populate the map if you created a new custom tag to do this for you (or found an existing custom tag somewhere else); in this case you might have:
which would work okay I suppose. However, if you're doing this sort of data population, you'd be much better putting the code in a servlet which then forwards to the JSP. It can store the map in the request scope. Accessing the map in the JSP is then very easy (see JSTL's <c:forEach> for example). The main lesson here is that JSPs should only present data they're provided with, they shouldn't obtain or modify it themselves.
How would I go about doing that using EL?
Very easy, just:would work consistently (since this is page-scope and is always searched first). Alternatively, the long-hand way:
This is giving an error.
That would be because EL is not like Java in many respects (it has some of the same operators, but that's about it). You can't invoke methods in EL - only a few (static) functions which must be predefined in the TLD. The expression language can only be used to retrieve values of variables, not set them.
Charles Lyons (SCJP 1.4, April 2003; SCJP 5, Dec 2006; SCWCD 1.4b, April 2004)
Author of OCEJWCD Study Companion for Oracle Exam 1Z0-899 (ISBN 0955160340 / AmazonAmazon UK )