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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T14:01:29+00:00 2026-05-21T14:01:29+00:00

I am fairly new to Spring with annotations and JSTL. I am trying to

  • 0

I am fairly new to Spring with annotations and JSTL.

I am trying to pass the value of index count from JSP to Spring Controller. However, I do not know how I can do so. I cannot set this count as a path variable or a request parameter. Is there a way in JSP to set a property in the Model to a particular value?

Sample code (from here)

...
<form:form modelAttribute="${questionForm}"  ... >
<%-- render HTML for your question, etc. --%>
${questionForm.question}
... 
</p>

<%-- below list your answer fields (your collection) --%>
      <c:forEach var="answer" items="${questionForm.answers}" varStatus="counter">
       <%-- display your single answer field (text area) here, 
       each element of your list may be accessed as  ${answer}, 
       and you can also access the index of the element in the list via ${counter.index} --%>

      </c:forEach>
      ... other fields, submit buttons, etc.
</form:form>
...

In this example can I set ${counter.index} to a property in Model {questionForm} ?

  • 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-21T14:01:30+00:00Added an answer on May 21, 2026 at 2:01 pm

    You’re misunderstanding what the JSP is doing.

    The Spring controller generates a complete model, which is forwarded to the JSP. The JSP then extracts the data from the model and renders it.

    The JSP does not, and cannot, “call back into” to the controller. Everything the JSP needs to do its job should be out into the model by the controller in advance.

    The comments inside the <c:forEach> are giving you all the clues you need to complete the exercise.

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

Sidebar

Related Questions

I am fairly new Akka world and was trying to use akka-spring integration. I
Fairly new to Spring, so I'm having some trouble with this. I'm trying to
I'm fairly new to Spring and I need a bean that has two properties
I'm fairly new to C#, and trying to figure out string insertions (i.e. some
Fairly new to Objective C and trying to work within Storyboards given it's the
I fairly new to JQuery and perhaps trying to achieve something that might be
I am fairly new to C#, and i am trying to make a teacher
I'm fairly new to MVC 4 and I'm trying to localize the Tooltip and
I'm hoping not to re-invent the wheel -- I'm fairly new to Java, but
Being fairly new to MVC 3 I am not sure of the best approach

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.