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

  • SEARCH
  • Home
  • 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 7882811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:22:25+00:00 2026-06-03T04:22:25+00:00

I have an object (collection) that I am putting into request before constructing a

  • 0

I have an object (collection) that I am putting into request before constructing a JSP page based on the state of the object.

        Map<Integer, QuestionBO> questionsIdsMap = new TreeMap<Integer, QuestionBO>();

        for (QuestionBO question : questionsForSubject) {
            questionsIdsMap.put(question.getQuestionId(), question);                
        } 

        request.setAttribute("questionsForSubject", questionsIdsMap);

Then I do some manipulations with the form and submit the whole page back to the servlet for processing.

    <jsp:useBean id="questionsForSubject" class="java.util.Map" scope="request"/>

    <c:if test="${not empty questionsForSubject}">
    <form  action="/TutorWebApp/controller" method="POST" name="addQuestionForm">
        <input type="hidden" name="command" value="add_question_list" />
        <input type="hidden" name="testName" value="${testName}"/> 
        <input type="hidden" name="questionsForSubject" value="${questionsForSubject}"/>
        <table border ="1">
            <tbody>
                <c:forEach items="${questionsForSubject.keySet()}" var="questionID">
                    <tr>
                        <td>
                            <input type="checkbox" name ="choosen_question" value="${questionID}">
                            ${questionsForSubject.get(questionID).getQuestion()}
                            <br />
                        </td>
                    </tr>
                </c:forEach>
            </tbody>
        </table>
        <input type="submit" value="Add questions"/>              
    </form> 
    </c:if>  

What is the conventional way of passing of the previously mentioned collection to make it available on the servlet-side?

I should do it without any frameworks.

  • 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-06-03T04:22:26+00:00Added an answer on June 3, 2026 at 4:22 am

    Since you have used

    request.setAttribute("questionsForSubject", questionsIdsMap);
    

    you don’t need to use the jsp:useBean tag.
    For the display, try

    <c:forEach items="${questionsForSubject}" var="current">
                    <tr>
                        <td>
                            <input type="checkbox" name ="choosen_question" value="${current.key}">
                            ${current.value}
                            <br />
                        </td>
                    </tr>
    </c:forEach>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a json object collection of geo locations that I build in the
I have an object that has a child collection: class Person { public string
I have an object in a multi-threaded environment that maintains a collection of information,
I have a method that can return either a single object or a collection
I have an Asset object that has a property AssignedSoftware, which is a collection.
I have a custom object that implements INotifyPropertyChanged. I have a collection of these
I have several methods that populate a SQLCommand objects parameter collection from an object
I have an ItemsControl that is bound to a collection of objects. Each object
I have a root object that has a property that is a collection. For
I have a List<string> collection that I would like to bind into my ListView

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.