el eval v literal

G

grasp06110

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
 
G

grasp06110

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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top