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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:58:34+00:00 2026-06-11T05:58:34+00:00

I am making a web view using jsp, javascript and html. I have a

  • 0

I am making a web view using jsp, javascript and html. I have a list of elements that when clicked on calls among other things the javascript function generatePictureSlider. The idea is that a set of pictures is associated with each element in the list and a slider is created when one of the elements is clicked on.

This is the code that creates my list:

<div class="valg">
    <ol id="selectable">
    <c:forEach items="${kandidatliste}" var="kjoretoy" varStatus="rowCounter">

        <li id="${rowCounter.index}" class="ui-widget-content">
            <c:choose>
               /*Some code that displays content based on a variable in the kjoretoy var */
            </c:choose>

            <c:out value="Reg nr: ${kjoretoy.kjennemerke} "/>
            <c:out value="Score: ${kjoretoy.score} "/>
            <c:out value="Passering: ${kjoretoy.passeringsString} "/>                       

            <input id="removeVehicle" type="submit" value="X" />
            <input id="checkVehicle" type="submit" value="Sjekk"/>
        </li>   
    </c:forEach>        
    </ol>
</div> 

The #selectable ol is bound to a click function in javascript. This click function is the one that calls on generatePictureSlider. So, when one of the elements in the list is clicked on, I want to display the pictures associated with the element in a slider.

Thus, I have to generate the html that displays the slider dynamically.

My problem is that I get this error: java.lang.NumberFormatException: For input string: "+parseInt(index)+"

Index here is naturally the index of the element that has been click, which corresponds to the place the element has in an arraylist which the view has received from the Java application. This arraylist is called “kandidatliste” as you will see in the function under.

function generatePictureSlider(index){
    $('div#switcher-panel').html('');

    var html = '<div id="container">'+
        '<div id="banner">'+
        '<ul class="bjqs">'+
        '<li><img src="/nonstop/bildekjennemerke=${kandidatliste['+parseInt(index)+'].kjennemerke}&bildeNr=${0}" title="${kandidatliste[0].kjennemerke}_${0}" width="350" height="220"/></li>'+
        '</ul></div></div>';

    $('div#switcher-panel').append(html);               
}

How can I make the javascript variable index be an integer so that the JSP does not crash and shows the picture associated with the element in index index.

I am of course open to other suggestions on how to solve it. The essence is that based on the element a user clicks on, I want to show images and other data associated with that element on the page.

  • 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-11T05:58:36+00:00Added an answer on June 11, 2026 at 5:58 am

    JSP pages runs server-side, and prints an HTML document that may include Javascript, on the other hand, Javascript runs in the client’s browser, it doesn’t make sense to generate JSP with javascript because it’ll be on the client’s browser, and it won’t work since JSP must be resolved server-side, you need to resolve this before send it to the client, you could use a Scriptlet, but i don’t recommend it, i don’t know exactly how your app works, but i would load the pictures dinamically using ajax.

    If you provide more information i could improve the answer.

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

Sidebar

Related Questions

I'm making a web site that users can build their TV watch list. They
I am making a web page in that I have used Ajax calendar to
I have create a web application using CodeIgniter making at first a login interface.
I have a web app that uses a lot of mysql_query calls--mainly because I
I'm making a web project that is fitted to the iPad screen. I'm trying
I am making a web-based application and i have text-fields where the values are
I am making a web-based logviewer using extjs. I would like new log-lines to
I am making a web page which will allow users to input and view
I'm making a web application in which certain pages are login-protected. I have created
I am Making an Iphone application which is web-service enabled. Also I have skeleton

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.