JSP include and expression language

J

Jeff Taylor

I'm trying to separate the details of the input elements on my forms
from the form itself. In doing this, I am creating small JSPs for
things like a text fields and select/comboboxes and including them
into the main jsp. I'm running into a problem when the small jsps
need to access something like a list that is stored in the request
attributes. I want to pass the name of the attribute to the small jsp
like:

<jsp:include page="selectlist.jsp" flush="true">
<jsp:param name="listname" value="mylist"/>
<jsp:param name="fieldid" value="myselectlistname"/>
</jsp:include>

and then in selectlist.jsp

<SELECT name="${fieldid}" >
<c:forEach var="value" items="${listname}">
<OPTION value="${value.code}">${value.display}</OPTION>
</c:forEach>
</SELECT>

The values get passed correctly, but I need the items= to evaluate to
the list, not the name of the list. I tried adding an extra set of
${} around the ${listname}, but that didn't work too well. Is there
any way to cause a double-evaluation of the EL parameters? I have all
the proper taglib includes and this works if it is in my main jsp, but
I want to have the level of indirection.

I'm using Tomcat 5.0.16 and have the JSP 2.0 information enabled along
with the EL enabled.

Thanks,
Jeff
 

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,969
Messages
2,570,161
Members
46,705
Latest member
Stefkari24

Latest Threads

Top