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 6344901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:43:41+00:00 2026-05-24T20:43:41+00:00

I have problems with getting my JSP view right. What I intend to do

  • 0

I have problems with getting my JSP view right. What I intend to do is to send a List that contains questions and each question object is a text field and a List with alternatives.

My intention is to be able to edit multiple questions (both to be able to edit the text/name of the question and edit the containing alternatives).

My backing object is now sending an List question.

Here is my JSP which are failing with invalid property of bean class.

        <form:form commandName="question">
        <form:errors path="*">
            <fieldset class="stdframe">
                <legend>Question</legend>
            </fieldset>
        </form:errors>

        <div class="stdframe">
            <c:forEach var="q" items = "${question}" varStatus = "s">           
                <p><b>Question:</b></p>
                <p><form:input size="67" path="${q.text}"/></p>
                <br/>
                ${q.text}
                <ul>
                    <c:forEach var="alternative" items = "${q.alternatives}" varStatus = "t">
                        ${alternative.text}
                        <li><form:input path = "${alternative[$t.index].text}" /></li>
                    </c:forEach>
                </ul>
                <br/>
            </c:forEach>
                <input type="submit" class="submit" value="Save" />
                <input type="button" class="button" onClick="back()" value="Back"/>
        </div>
</form:form>

I have tried both ${q.text} and ${q[$s.index].text}. When I just print ${q.text} it shows the correct text for the question object. Same goes for alternative.

What can I do to correctly bind the form to the objects?

In addition when I store an object which contains a list of other object, will the list be stored itself in the database?

  • 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-24T20:43:42+00:00Added an answer on May 24, 2026 at 8:43 pm

    You may need to wrap your List in a simple object with the List as a field:

    class MyListWrapper { List questions; } // etc.
    

    If you use that as your command/form object, you should be able to do something like this in the JSP:

    <form:form commandName="wrapper">
    // ... 
            <c:forEach var="q" items = "${wrapper.questions}" varStatus = "s">
               <p><b>Question:</b></p>
                <p><form:input size="67" path="questions[${s.index}].text"/></p>
    // ... 
                   <c:forEach var="alternative" items = "${q.alternatives}" varStatus = "t">
                        ${alternative.text}
                        <li><form:input path = "questions[${s.index}].alternatives[${t.index}].text" /></li>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two problems. The first one is that I'm using JSP and that
I get user list from database in jsp. In each user I have a
I have some problems on a site with the concurrent access to a list.
I have two list on my request on jsp. First one is productGroupName, and
I have written web apps with JSP in the past. Now, I'm getting started
I have some problems with getting my website to log out the authenticated user
I am having problems getting a function that clicks all search matched checkboxes. The
I have a login.jsp page which contains a login form. Once logged in the
I realsie that similar questions have been answered here about this problem but im
I have problems getting a JQuery Edit-In-Place textarea to be a fixed size. Basically

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.