facebook

No data shown

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #222590 Reply

    wk3000sg
    Member

    – Is there any problem with these codes in processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException.

    – it seems that it execute the “else” rather than executing the “if(temp…(“select”))” statement when i have a sql query =”select * from Business”.

    <–code starts here–>
    😀
    if(temp.equalsIgnoreCase(“select”)){
    data= db.execSelectQuery(request.getParamete(“sqlstatement”));
    request.getSession().setAttribute(“data”, data);
    request.getRequestDispatcher(“/WEB-INF/pages/DisplayData.jsp”).forward(request, response);

    }else if ((temp.equalsIgnoreCase(“Update”) || temp.equalsIgnoreCase(“Insert”) || temp.equalsIgnoreCase(“Delete”))){
    updatedata= db.execUpdateQuery(request.getParameter(“sqlstatement”));
    Integer intobj = new Integer(updatedata);
    request.getSession().setAttribute(“intobj”, intobj);
    request.getRequestDispatcher(“/WEB-INF/pages/DisplayCUDData.jsp”).forward(request, response);

    }
    else{
    request.getRequestDispatcher(“/WEB-INF/pages/NoData.htm”).forward(request, response);
    }
    }
    😕
    <—code ends here–>

    #222594 Reply

    Riyad Kalla
    Member

    I think you need to give more background into the code that executes this and how it works. Have you tried printing out “temp” immediately before your first if to see what the value is?

    #222597 Reply

    wk3000sg
    Member

    err…how do u display variable temp from servlet to html???

    #222598 Reply

    Riyad Kalla
    Member

    You don’t, just print it out and look at your Tomcat (or other) application server console you should see a line with the output in it.

    #222599 Reply

    wk3000sg
    Member

    what is the statement to print?

    #222600 Reply

    Riyad Kalla
    Member

    System.out.println(“temp’s value is: [” + temp + “]”);

    that way you can tell what the value of Temp is and maybe why the if-condition isn’t being hit.

    #222601 Reply

    wk3000sg
    Member

    oh…sry…i knew it….thanks for your paitients. A hundred thanks here!!

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: No data shown

You must be logged in to post in the forum log in