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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:08:26+00:00 2026-06-06T06:08:26+00:00

I am new to Java EE programming. Following my understanding on jsp. Corret me

  • 0

I am new to Java EE programming. Following my understanding on jsp. Corret me if I am wrong

– JSP pages are converted to servlet first then to html and resulted html page is displayed in browser.

Now suppose jsp page is displayed in browser i.e now it is html page and I have a java List which have names or some sort of data that I want to print on the currently loaded page. I can get the List object using ajax but the how will I display it on html as html cant render java collections.

Correct me wherever I misunderstood the flow or basic concepts.

Thanks.

  • 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-06T06:08:28+00:00Added an answer on June 6, 2026 at 6:08 am

    You could use ajax (using jQuery would be easy) to make a call to your Servlet

    function callMe(){
        $.ajax({
          type: "POST",
          url: "/someServlet",
          data: { param1: "val1" , param2: "val2" }
        }).done(function( data) {
           //TODO
        });
    }
    

    Now on Servlet, in doPost(), Use Gson to generate JSON representation for your collection

    String parameter1 = request.getParameter(param1);
    String parameter2 = request.getParameter(param2);
    //call to service to generate the collection
    //for example List<Employee>
    List<Employee> employees  = someService(parameter1, parameter2);
    //using google's gson
    Gson gson = new Gson();
    String json = new Gson().toJson(employees);
    response.setContentType("application/json");
    response.setCharacterEncoding("UTF-8");
    response.getWriter().write(json);
    

    Now we have response in javascript function as a array of javascript objects, So modify it to

        }).done(function( data) {
            //some processing for display
            var len = data.length
            for (var i=0; i<len; ++i) {
                   var employeeFirstName =  data[i].firstName;
                   var employeeLastName =  data[i].lastName;
                   //set it to some DIV, or do the processing you want
            }
          }
    
        });
    

    Also See

    • How to call a java method from jsp by clicking a menu in html page?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

New to android programming. Getting Following error. 04-07 14:49:05.452: ERROR/AndroidRuntime(1566): FATAL EXCEPTION: main java.lang.OutOfMemoryError
First, i'm new at Java-programming and my native lang is not english, but still
I'm quite new to Java Programming and am writing my first desktop app, this
I'm new to Java, but not new to programming, so as my first project
I´m totally new to programming in java, and following some basic tutorials for my
I am fairly new to Java programming and was following a tutorial located here:
hi I am new here and new in Java programming as well actually my
sry about my english :) Im new to Java programming and i have a
I have been working on Eclipse recently. I am fairly new to java programming,
Before I start know this: I am extremely new to Java and programming. How

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.