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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:57:21+00:00 2026-06-04T21:57:21+00:00

I am doing some manipulation on servlet and set the same in session and

  • 0

I am doing some manipulation on servlet and set the same in session and i use the value when i redirect to some page. but while redirecting to the page the values are not coming,

I know that this is very basic question but still i am unable to do.

here is my servlet :

protected void doPost(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
        String path = getServletContext().getRealPath("/accesscarddata/");

        doGet(request, response);
        readFile(request, response);
        prepareExcelEmployeeListToMap(request, response);
        classifyEmployeesMapEntries(request, response);
        prepareReport(request, response);
        generateLeaveReport(request,response);

        //request.getRequestDispatcher("upload.jsp").forward(request, response);
        response.sendRedirect("upload.jsp");

    }

I tried these both but the values are not coming in jsp.

EDIT :
This is how i read from session in jsp

<%@ page contentType="text/html"%>
<%@ page pageEncoding="UTF-8"%>
<%@ page import="java.util.*"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%
        String leaveReport = "";
        if ((session.getAttribute("leaveReport") != null)) {
            leaveReport = (String) session.getAttribute("leaveReport");
        }
%>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Comparing access-card Data with leave manager Data</title>
    <link href="css/sling.css" rel="stylesheet" type="text/css" />
    <script language="JavaScript" src='script/cal.js'></script>
    <!-- Below imports for Blanket purpose-->
    <script src='script/blanket.js'></script>

%> 

this is how i try to get the value while loading the page, firt time the javascript alert is shown but the alort is not shown when the request is redirected from servlet.

bodyOnLoad();
    function bodyOnLoad(){
        alert("bodyOnLoad");
        var leaveReport = '<%=leaveReport%>';
        alert("leaveReport :"+leaveReport);
        if(leaveReport!=null && leaveReport!=""){
            displayLeaveReport(leaveReport);
        }
    }

and this is what is my javascript method :

function displayLeaveReport(leaveReport){
            if(leaveReport == ""){
                document.getElementById("leaveReport").style.display = "none";
            } else{
                document.getElementById("leaveReport").style.display = "";
            }
        }

JSP :

<tr>
                            <td width="100%" valign="top">
                                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                    <tr>
                                        <td class="title_box" align="left">Leave to be availed Employees</td>
                                    </tr>
                                </table>
                                <table width="100%" align="center" border="0" cellspacing="0" cellpadding="0">
                                    <tr>
                                        <td width="100%" align="left" class="tableBorder" valign="top">
                                            <table width="100%"  border="0" cellspacing="0" cellpadding="0" bgcolor="#f9fae3" >
                                                <tr class="lightrow">
                                                    <td width="10%" class="title_sub" align="center">S.No</td>
                                                    <td width="35%" class="title_sub" align="center">Employee ID</td>
                                                    <td width="35%" class="title_sub" align="center">Employee Name</td>
                                                    <td width="20%" class="title_sub" align="center">Action</td>
                                                </tr>
                                            </table>
                                            <div id="leaveReport" align="right" style="display : none;height:100px; overflow:auto"></div>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                </tr>
  • 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-04T21:57:23+00:00Added an answer on June 4, 2026 at 9:57 pm

    It is possible to set values in div tag if you use ajax technogies like dwr,if not it is not possible to set values in div tag, change your code like follows in jsp and the vlaues will be displayed.

    if(reportMap.size()>0){
         Iterator<Map.Entry<String, String>> entries = reportMap.entrySet().iterator();
         while (entries.hasNext()) {
            Map.Entry<String, String> entry = entries.next();
            employeeid = entry.getKey();
            employeename = entry.getValue();
            %>
            <tr class='<%=classname %>'>
            <td width="10%" class="title_sub" align="center"><%=sno %></td>
            <td width="35%" class="title_sub" align="center"><%=employeeid %></td>
            <td width="35%" class="title_sub" align="center"><%=employeename %></td>
            <td width="20%" class="title_sub" align="center">Action</td>
            </tr>
            <%
            style++;
            }
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm doing some manipulation and retrieval of values stored in a table. Each row
All, I'm doing some image manipulation in Scala by making use of BufferedImages and
I'm doing some string manipulation to build a jquery selector. Does the trick, but
I ran into a very vague error while doing some simple jQuery DOM manipulation.
In my main script, I am doing some archive manipulation. Once I have completed
Doing some jquery animation. I have certain divs set up with an attribute of
While doing some JavaScript performance tests I came up with the following piece of
While doing some random experimentation with a factorial program in C, Python and Scheme.
While doing some refactoring I've found that I'm quite often using a pair or
I'm doing some form error handling/manipulation and I have the need to remove an

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.