Results 1 to 6 of 6
  1. #1
    shivaulagam is offline Member
    Join Date
    Feb 2014
    Posts
    3
    Rep Power
    0

    Default Java, JSTL, MySql, Apache Tomcat 6 - Data not retrieved - Session Issue

    I am shiva, developing an dashboard application in Java, JSTL, MySql, Apache Tomcat 6.
    I have the below files
    1. Dashboard.java (model)
    2. DashboardDAO.java (dao)
    3. DashboardController.java (Controller)
    //Source

    protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
    String forward = "";
    forward = LIST_DASHBOARD;
    HttpSession session = req.getSession(true);
    session.setAttribute("dboard", dao.getAlldashboard(req));
    setMasterInfo(req);
    RequestDispatcher view = req.getRequestDispatcher(forward);
    view.forward(req, res);
    }

    //Source
    4. Dashboard.jsp (view)
    //Source

    <c:forEach items="${dboard}" var="dbrd">
    <tr>
    <td><c:out value="${dbrd.dname}" /></td>
    <td style="display: none;"><c:out value="${dbrd.did}" /></td>
    <td><c:out value="${dbrd.pname}" /></td>
    <td style="display: none;"><c:out value="${dbrd.pid}" /></td>
    <td><c:out value="${dbrd.wname}" /></td>
    <td style="display: none;"><c:out value="${dbrd.wid}" /></td>
    <td><c:out value="${dbrd.lname}" /></td>
    <td style="display: none;"><c:out value="${dbrd.lid}" /></td>
    <td><fmt:formatDate pattern="dd MMM,yyyy" value="${dbrd.trns_date}" /></td>
    <td align="right"><c:out value="${dbrd.units}" /></td>
    <td align="right"><c:out value="${dbrd.dunits}" /></td>
    <td align="right"><c:out value="${dbrd.variance}" /></td>
    <td><c:out value="${dbrd.notes}" /></td>
    </tr>
    </c:forEach>

    //source
    5. web.xml
    //source


    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
    <display-name>dboardtest</display-name>
    <session-config>
    <session-timeout>
    30
    </session-timeout>
    </session-config>
    <welcome-file-list>
    <welcome-file>dashboard.jsp</welcome-file>
    </welcome-file-list>
    </web-app>

    //source

    It works in the first time. But, after sometime the data is not retrieved and display empty screen. Once, i stop and start the server again, the data is getting retrieved again. But, later when we refresh the empty page is getting displayed again.
    Help is really appreciated.
    Thanks in advance.
    Shiva.

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,105
    Rep Power
    6

    Default Re: Java, JSTL, MySql, Apache Tomcat 6 - Data not retrieved - Session Issue

    Well I can only guess without any actual relevant code: you are not closing your database connections, so eventually they run out.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  3. #3
    shivaulagam is offline Member
    Join Date
    Feb 2014
    Posts
    3
    Rep Power
    0

    Default Re: Java, JSTL, MySql, Apache Tomcat 6 - Data not retrieved - Session Issue

    Many Thanks gimbal2. I do close my connection objects. The issue is the data is not getting retrieved after the session expires i guess. Some session issues,but could not resolve it by myself.
    -Shiva.

  4. #4
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,105
    Rep Power
    6

    Default Re: Java, JSTL, MySql, Apache Tomcat 6 - Data not retrieved - Session Issue

    Well then you're stuck forever; I would take a different attitude, you CAN resolve this yourself - just not yet.

    Step 1: don't guess, get facts. WHERE is the code hanging EXACTLY. If there is an internal problem there MUST be some logging in the server logs. If there is not, you may have to pepper your code with logging statements to get at least an idea.

    And by the way:

    I do close my connection objects
    I believe that you are closing most of them. But can you say for sure that you are ALWAYS closing database connections? You wouldn't be the first one to not properly use finalize clauses to close resources and be under the wrong assumption that connections are always getting closed.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  5. #5
    shivaulagam is offline Member
    Join Date
    Feb 2014
    Posts
    3
    Rep Power
    0

    Default Re: Java, JSTL, MySql, Apache Tomcat 6 - Data not retrieved - Session Issue

    I strongly guess, there is some problem with Session Management. if i give HttpSession session = req.getSession(false); the data will get removed during navigating to other pages. I am very poor in session management. anyone can help me?

  6. #6
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,105
    Rep Power
    6

    Default Re: Java, JSTL, MySql, Apache Tomcat 6 - Data not retrieved - Session Issue

    You're still guessing. No, nobody can help you. Stop guessing and start doing actual work as I already told you to do.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. issue with jstl 1.1 and tomcat 7.0
    By dark-sun in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 01-27-2011, 07:31 AM
  2. Oracle/JSTL - All data not being retrieved/displayed
    By kev_thomas in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 10-09-2009, 11:26 AM
  3. Oracle & JSTL - Data not being retrieved correctly?
    By kev_thomas in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 10-09-2009, 11:08 AM
  4. Oracle & JSTL - Data not being retrieved correctly?
    By kev_thomas in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 10-09-2009, 10:38 AM
  5. Replies: 4
    Last Post: 08-09-2007, 10:41 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •