jsp:include c:import question

A

alan_sec

Hi.
Is there a way to pass dynamic number of parameters to some jsp, using
jsp:include or c:import. Parameter names and values are stored in
java.util.List of JavaBeans(containing name and values setter and
getter methods). List size is dynamic.
Is tried something like this (using c:import):
<c:import url="some.jsp">
<c:forEach var="bean" items="${list}">
<c:param name="${bean.name}" value="${bean.value}"/>
</c:forEach>
</c:import>
But it fails because <c:forEach> tag can not be inside <c:import> tag.
Is there any way to solve this?
Thanks.
Alan
 
M

Manish Pandit

Hi Alan,

If they are all string key-value pairs, you can create a querystring
and append it to the URL.You can loop over the list and create a
querySring variable that looks like key1=value1&key2=value2&keyn=valuen
at the end of the loop, and create your url as some.jsp?+queryString.

-cheers,
Manish
 

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,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top