Sure. Assuming that xyz is a scoped variable that is an array or List (or really any other type of object):
Or are you really asking if you can create and populate such elements from within the JSP page? In which case, I'd ask why you'd do this in a JSP rather than in the servlet controller. [ February 07, 2006: Message edited by: Bear Bibeault ]
Why can't you move it into the action? It's really the right thing to do.
I've never tried to create and populate a List on a JSP page. It's quite possible to do for JavaBeans and even Maps with a combination of <jsp:useBean> and <c:set>.
But Lists... not so sure...
If it's something you have to do on the page (I would not), perhaps you can create a List or array in a JavaBean wrapper so that you can manipulate it via the EL and JSTL, or you could just resort to some custom actions to do it.
But really, factoring it into the controller/action is the best practice...
Yes, you can set anything you want into a scoped variable. The issue is the code necessary to create and populate such constructs.
At this point I'd be asking what you are trying to accomplish by refactoring the pages away from scriplets. The whole purpose of using the JSTL and EL on scriptless pages is to refactor the pages to pure view elements.
If you are unwilling to move inappropriate processing off the page and are just going through the motions of converting scriplet processing to JSTL equivalents (not always possible, as you have seen), what's the point of the exercise? What are you trying to gain by the conversion?
Joined: Feb 07, 2006
Its just that somebody wrote a bad piece of code and now i have to deal with converting it into JSTL.
Cant affored to refactor it..cus thaen it would affect the entire application.