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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T03:42:49+00:00 2026-06-05T03:42:49+00:00

I have a jsp file where on a button click a bunch of rows

  • 0

I have a jsp file where on a button click a bunch of rows shows up in a html table format.

The rows have checkboxes as well. When I click a checkbox and hit another button i am able to retrieve the selected row tags and push them into an array.

How can I pass this array to the servlet\scriptlet.

Array consists of tags like so: '< td > hi < /td> <td>ho</td>','< td > hi < /td> <td>ho< /td>',….

I included json2.js and tried stringify but servlet always comes back saying null when i use request.getparametervalues()

i also dont have a submit form so that rules out the submit form part of the coding.

Any and all advices very much appreciated.

code in js:

$.ajax({
    type: 'POST',
    url: 'book.jsp',
    data: JSON.stringify({ nameParameter: colheader }),
    dataType: 'json',
    contentType: "application/json; charset=utf-8",
    success:function(data){alert(data);},
    error:function(){alert('error');}
});

Code in scriptlet book.jsp

String[] arrayData=request.getParameterValues("nameParameter");
System.out.println("########nameParameter"+arrayData);
  • 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-05T03:42:50+00:00Added an answer on June 5, 2026 at 3:42 am

    I found a way to do it.

    I add a rowid to each checkbox with the value of the primary key.

    On selected a checkbox I post the rowid’s to the scriptlet using the below

    $.post('target.jsp', { id: selectedrows }); 
    

    selectedrows is an array of selected rowids.

    I set the resultset obtained into the session in the jsp.

    I retrieve the resultset from the session in my scriptlet (target.jsp) and filter based on my selected rowids. That way I have all the values and need not pass the entire rowtag.

    Alternatively you can query the database again with the selected rowid’s, I chose not to do it as my resultset does not hold more than 100 rows.

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

Sidebar

Related Questions

I have created a child.jsp file which has a button named Continue. I have
I have jsp file: <%@ page language=java contentType=text/html; charset=UTF-8 pageEncoding=UTF-8%> <%@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core%>
I have a jsp file in which I have a form. It shows data
I currently have two files, register.html and register.jsp. The HTML file asks the user
I have a jsp file in the root of .war file. and then I
I have a .jsp file that receives a request and checks the request's parameters.
I'm getting an exception when i have my jsp file on the webserver, it
I have these in a jsp file. But these values are not updated in
In my .jsp file I have the code below. How can I compare the
I have a JSP file which creates an Excel document. I want to dynamically

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.