Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3842004
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T15:43:54+00:00 2026-05-19T15:43:54+00:00

Greetings, here is the problem. I have a page called entList.jsp , that works

  • 0

Greetings, here is the problem. I have a page called entList.jsp, that works with a collection:

<c:forEach var = "pack" items = "${packingList}">
<!--Here goes something with outputting the pack instance in a required format-->
</c:forEach>

Everything works great, and the parameter packingList is passed as an attribute of the request by the action handler that calls this page. Actually packingList is of type Collection<GenericBean>.

It turned out that this page (the fragment it stores) is actually pretty useful, and can be used in many places with different collections. So I tried to include this page like this (in another page):

<jsp:include page="entList.jsp">
  <!-- Pass the required collection as a parameter-->
  <jsp:param name = "packingList" value = "${traffic.packingList}"/>
</jsp:include>

However, now this fragment does not see the argument packingList. I tried to rewrite the fragment like this (since now it’s a parameter):

<c:forEach var = "pack" items = "${param.packingList}">
<!--Here goes something with outputting the pack instance in a required format-->
</c:forEach>

But now it generates an exception, since it treats packingList as a string and not a collection. So right now the solution is like this – set the required collection as an attribute in the action handler code:

// This is the original instance set by the action
request.setAttribute("traffic", traffic);
// And this is the additional one, to be used by entList.jsp
request.setAttribute("packingList", traffic.getPackingList());

So the question is – can jsp:param tag receive a collection as it’s value? I read the documentation for the JSP tags and it remains unclear – it seems like the only thing you can pass in such a way it’s string parameters (or something that can be converted to string), but no complicated objects.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T15:43:55+00:00Added an answer on May 19, 2026 at 3:43 pm

    you should be using a tag file, and declare the tag with the correct parameter types.

    e.g. as packingList.tag

    <%@tag %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <%@attribute name="packingList" required="true" type="java.util.Collection<Packing>"
            description="the packing list." %>
    <c:forEach var = "pack" items = "${packingList}">
    <!--Here goes something with outputting the pack instance in a required format-->
    </c:forEach>
    

    Then, place this file in WEB-INF/tags

    then, add to your jsp file

    <%@ taglib tagdir="/WEB-INF/tags" prefix="pack" %>
    
    <pack:packingList packingList="${packingList}"/>
    

    see http://download.oracle.com/javaee/1.4/tutorial/doc/JSPTags5.html for more info

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.