Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > el eval v literal

Reply
Thread Tools

el eval v literal

 
 
grasp06110@gmail.com
Guest
Posts: n/a
 
      09-10-2008
Hi Everybody,

Is there a way to get an eval of a el expression. I'm trying to
display the contents of an ArrayList that exists in the session by
passing in the name of the list so I would like to do something like
send the following request:

http://myPage?listName=myList

and then get the list from the session and iterate through it to
display the contents. I was hoping that ${param.listName} would
evaluate to the literal string myList in a statement such as:

${${listName}}

and then I could do something like:

<c:forEach var="current' items="${${listName}} >

is there a way to do this?

Thanks,
John
 
Reply With Quote
 
 
 
 
grasp06110@gmail.com
Guest
Posts: n/a
 
      09-10-2008
On Sep 10, 7:28*am, (E-Mail Removed) wrote:
> Hi Everybody,
>
> Is there a way to get an eval of a el expression. *I'm trying to
> display the contents of an ArrayList that exists in the session by
> passing in the name of the list so I would like to do something like
> send the following request:
>
> http://myPage?listName=myList
>
> and then get the list from the session and iterate through it to
> display the contents. *I was hoping that ${param.listName} would
> evaluate to the literal string myList in a statement such as:
>
> ${${listName}}
>
> and then I could do something like:
>
> <c:forEach var="current' items="${${listName}} >
>
> is there a way to do this?
>
> Thanks,
> John


This works but requires knowing the object is in the session up front:

<html>

<%@ page isELIgnored="false" %>
<%@ taglib uri="/tld/jstl/c.tld" prefix="c" %>

<body>
<h2>${param.name}</h2>
<table>
<jsp:scriptlet>
String listName = request.getParameter("name");
Object list = request.getSession().getAttribute(listName);
request.setAttribute("list", list);
</jsp:scriptlet>
<c:forEach var="row" items="${list}">
<tr>
<td>
${row}
</td>
</tr>
</c:forEach>
</table>
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
</body>

</html>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
eval('07') works, eval('08') fails, why? Alex van der Spek Python 6 01-08-2009 08:24 PM
Different behavior between eval "07" and eval "08" Liang Wang Perl Misc 8 02-02-2008 08:31 PM
DataBinder.Eval and Eval. craigkenisston@hotmail.com ASP .Net 1 06-16-2006 05:33 PM
DataBinder.Eval for an object's property property... like Eval(Container.DataItem,"Version.Major") Eric Newton ASP .Net 3 04-04-2005 10:11 PM
What's wrong with rpc-literal? Why use doc-literal? Anonieko Ramos ASP .Net Web Services 0 09-27-2004 09:06 AM



Advertisments