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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:13:52+00:00 2026-05-15T13:13:52+00:00

in my servlet i called an instance of a class.java( a class that construct

  • 0

in my servlet i called an instance of a class.java( a class that construct an html table) in order to create this table in my jsp.

the servlet is like the following:

String report=request.getParameter("selrep");
String datev=request.getParameter("datepicker");
String op=request.getParameter("operator");
String batch =request.getParameter("selbatch");

System.out.println("report kind was:"+report);
System.out.println("date was:"+datev);
System.out.println("operator:"+op);
System.out.println("batch:"+batch);


if(report.equalsIgnoreCase("Report Denied"))
{
    DeniedReportDisplay rd = new DeniedReportDisplay(); 
    rd.ConstruireReport();
}
else if(report.equalsIgnoreCase("Report Locked"))
{
    LockedReportDisplay rl = new LockedReportDisplay(); 
    rl.ConstruireReport();
}

request.getRequestDispatcher("EspaceValidation.jsp").forward(request, response);

in my jsp i can not display this table even empty or full.

note: exemple a class that construct denied Report has this structure:

   /*constructeur*/
                  public DeniedReportDisplay() {}

 /*Methodes*/

 @SuppressWarnings("unchecked")

                 public StringBuffer ConstruireReport()

                 { 
                     StringBuffer retour=new StringBuffer();
                     int i = 0;
                     retour.append("<table border = 1 width=900 id=sheet  align=left>");    
                     retour.append("<tr bgcolor=#0099FF>" );
                     retour.append("<label> Denied Report</label>");
                     retour.append("</tr>");                       
                     retour.append("<tr>"); 

 String[] nomCols ={"Nom","Prenom","trackingDate","activity","projectcode","WAName","taskCode","timeSpent","PercentTaskComplete","Comment"};
 //String HQL_QUERY = null;                      
  for(i=0;i< nomCols.length;i++)
  {
    retour.append(("<td bgcolor=#0066CC>")+ nomCols[i] + "</td>");

   }
  retour.append("</tr>");

     retour.append("<tr>");

                 try {

 s= HibernateUtil.currentSession();
 tx=s.beginTransaction();
 Query query = s.createQuery("select  opcemployees.Nom,opcemployees.Prenom,dailytimesheet.TrackingDate,dailytimesheet.Activity," +
   "dailytimesheet.ProjectCode,dailytimesheet.WAName,dailytimesheet.TaskCode," +
   "dailytimesheet.TimeSpent,dailytimesheet.PercentTaskComplete from  Opcemployees opcemployees,Dailytimesheet dailytimesheet  " +
   "where opcemployees.Matricule=dailytimesheet.Matricule  and dailytimesheet.Etat=3 " +
   "group by opcemployees.Nom,opcemployees.Prenom" );  


   for(Iterator it=query.iterate();it.hasNext();)
      {                                                                        
                        if(it.hasNext()){

                         Object[] row = (Object[]) it.next();


                         retour.append("<td>" +row [0]+ "</td>");//Nom
                         retour.append("<td>" + row [1] + "</td>");//Prenom
                         retour.append("<td>" + row [2] + "</td>");//trackingdate
                         retour.append("<td>"  +  row [3]+  "</td>");//activity
                         retour.append("<td>"  + row [4] +"</td>");//projectcode
                         retour.append("<td>" +  row [5]+ "</td>");//waname
                         retour.append("<td>" + row [6] + "</td>");//taskcode
                         retour.append("<td>" + row [7] + "</td>");//timespent
                         retour.append("<td>" + row [8] + "</td>");//perecnttaskcomplete
                         retour.append("<td><input type=text /></td>");//case de commentaire
                                     }
                                  retour.append("</tr>");


      }   
 //terminer la table.
                          retour.append ("</table>");

                          tx.commit();


                } catch (HibernateException e) 
                 {
     retour.append ("</table><H1>ERREUR:</H1>" +e.getMessage());
              e.printStackTrace();
                 }

                 return retour;
 }

thanks for help.

  • 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-15T13:13:52+00:00Added an answer on May 15, 2026 at 1:13 pm

    1) The instances of DeniedReportDisplay and LockedReportDisplay are created locally, no way to refer them once outside the if..else block.

    2) The method invoked ( rd.ConstruireReport() ) returns a StringBuffer and you should store it somewhere. Try to use Response.getWriter() and put all the response string into this writer.

    3) Suggest you to find some good tutorial books about how to design Servlets/JSP, the solution you tried to build is quite wried.

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

Sidebar

Ask A Question

Stats

  • Questions 502k
  • Answers 502k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Are you assuming that the Rendering event fires at a… May 16, 2026 at 2:42 pm
  • Editorial Team
    Editorial Team added an answer I will refer you to paramiko see this question ssh… May 16, 2026 at 2:42 pm
  • Editorial Team
    Editorial Team added an answer urlpatterns = __import__(project_urls).whateversubmodule.urlpatterns May 16, 2026 at 2:42 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I am trying to call a Servlet called AddClass.java using the following line in
i'm writing a servlet that receives a xml file, gives it to another class
I'm writing my Servlet application and would like to use the following static method
Can I call a servlet from JSP file without using a HTML form? For
I'm sure this is a beginner error... So I have a Java EE 6
I have an application where Servlet has a method called Update(ReqIn, ReqOut) . I
Using a Java servlet, is it possible to detect the true file type of
I trying to remove a cookie in a servlet with this code Cookie minIdCookie
I have recently created a web project in Java using eclipse. I have a
I have a system that I need to distrubte that works as follows. Servlets

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.