URGENT !!! - Bean method execution again ...


Web tier: servlets, JSP, Web frameworks: URGENT !!! - Bean method execution again ...

  1. URGENT !!! - Bean method execution again ... (4 messages)

    Hi !
    Thanks for the response. Actually I reload the JSP page thru javascript. The problem is the page is getting reloaded before the table get updated. So how to implement the page reloading in sync with the database. And the logic or code sample for implementing model view controller design would be appreciated.

  2. URGENT !!! - Bean method execution again ...[ Go to top ]

    at what point of execution is your javascript reloading?

    i'm imagining a scenario such that:

    form.jsp -> database insert -> view.jsp

    can you give some pseudocode for it? also, i'll write up some documentation about MVC and post a link to the site later... =p
  3. URGENT !!! - Bean method execution again ...[ Go to top ]

    I have a main JSP page with multiple frames (each one is a JSP page). In one frame (frame 1),I have a button called "Add child". In another frame (frame 2) has all parents with radio button for each of it. On select a prent and clicking the add child button, a new window pops up with some form fields (select box). The user selects from the list and clicks "add" button. In this the jsp calls a business method in a bean and finally updates the table and then reloads the second frame (frame 2, which has all parents), so the added child is also seen below the parent. But as of now, the child gets added in the table but the page does not show the child, (which means the page is getting reloaded before the table is getting added.
    Here is the code :
    Context ctx = getInitialContext();
    PartManagerHome pmh = (PartManagerHome) ctx.lookup("PartManager");
    PartManager pm = pmh.create();

    if(request.getParameter("hdAddFac") != null && request.getParameter("hdAddFac").equals("Y"))
        int index = request.getParameter("lstSuppFac").indexOf("/");
        String nfac = request.getParameter("lstSuppFac").substring(0, index-1);
        String nsupplier = request.getParameter("lstSuppFac").substring(index+2);
        String m_array[] = {"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
        Date date = new java.util.Date();
        java.sql.Date sqldate = new java.sql.Date(date.getYear(), date.getMonth(), date.getDate());
        String sdate = sqldate.toString();
        PartSupplier p_supp = new PartSupplier(request.getParameter("hdFac"), nsupplier, nfac, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, String.valueOf(session.getValue("userid")), sdate);

        pm.addNewSupplierfac(request.getParameter("hdFac"), p_supp);
    <SCRIPT LANGUAGE="Javascript1.2">
    var sleepcount = 0;
    while(sleepcount < 100)
    The while loop is to make the reloading after sometime.

  4. I would lose the frames and redesign this using multiple SEQUENTIAL JSP files.

    The MVC pattern might look like this:

    Form1 (JSP or HTML) -> servlet -> JSP

    The servlet handles the transaction, then forwards to the JSP which can handle the display of the parent-child thing. Or you could simply do this:

    HTML or JSP -> JSP

    In this case the second JSP would have all the database update code in it as well as the code to control the parent-child display. The MVC is preferred.

    Frames introduce all kinds of complexity, and most importantly this is a multithreaded environment so it is possible for frames to interfere with each other. By simplifying the design you will introduce a much greater degree of control over what is happening and make it much more predictable. Plus Javascript is unreliable because people can simply turn it off, at least in Netscape.

  5. hmm... maybe the page is actually being cached by the browser! =p how about setting the header to:

    response.setHeader("Expires", "Tues, 01 Jan 1980 00:00:00 GMT");