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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:32:04+00:00 2026-05-29T09:32:04+00:00

I have been working with ASP.NET for a few years and am now working

  • 0

I have been working with ASP.NET for a few years and am now working on a project using JSP, Struts, and Java so I am fairly new to this.

I have a for-loop in a JavaScript function that looks something like this:

<% int count=0; %>
for(i = 0; i < arrayCount; i++){
   jsArray[i] = <%= myBeanArrayList.get(count) %>;
   alert("i = " + i + "count = " + count);
   <% count++; %>
}

The count variable doesn’t increment even if I use <% count = count + 1 %>. I don’t understand why that piece of code doesn’t do as I want inside the loop. Does anyone have any suggestions on how I can increment the count for the JSP Bean?

  • 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-29T09:32:05+00:00Added an answer on May 29, 2026 at 9:32 am

    You are only looping on the client, not the server. The server code only gets executed once. So, for every iteration of the JavaScript loop, you are using the same value – myBeanArrayList.get(0). View source to look at the generated HTML code and that will probably help to clarify the problem.

    Edit: Instead, use server-side code to build a JavaScript array literal. I don’t really know JSP, and my Java is a little rusty, but wouldn’t this work?

    var jsArray = <%= new JSONArray(myBeanArrayList) %>;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on an ASP.Net MVC project and have been learning a few little
For the last 4 years I have been working as an ASP.NET developer in
I'm working on a asp.net mvc2 app. I have been using jquery to do
I've been using ASP.NET (C#) for the past two years. I have learned so
I have been using jQuery for a few years now and really have had
I have been working with ASP.NET MVC for a couple of months now and
I have been working on a small project on recent delived ASP.NET MVC 3
I have been working on a ASP.NET MVC 2 project and i've been thinking
I am new to asp.net and have been working through the tutorial - up
I have been working in Visual Studio 2010, in asp.net, i am using Jquery

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.