Opening new child window - Running servlet (JSP and Servlet)

Discussion in 'Java' started by agapitolw@yahoo.es, Aug 24, 2007.

  1. Guest

    Hi

    Currently , I have a javascript code that opens a child window. This
    child window is a Java Server Page called showdata.jsp that uses some
    data from the database.

    I have used this function to open my page :

    <script language="JavaScript">
    function open_a_window(){
    childwin = window.open("showdata.jsp","dataname",
    "height=300,width=100");
    </script>



    Ideally, a servlet should be executed to do the business logic and
    extract the data that will be displayed on showdata.jsp. Moreover, the
    user may perform search in the child window, to filter or find the
    results returned. My questions are as follows:

    1. How to run servlet from Javascript that does the logic and then the
    results are displayed in showdata.jsp (as a child window)?

    2. How to go about filtering or finding results in showdata.jsp while
    it is open ? what is the recommended method? because the results have
    a check box next to them and when user choses and closes window they
    are reported back to the main JSP which opened the child JSP.

    Any suggestions, reading materials, code , etc is very appreciated.

    Thanks in advance
    Agapito
     
    , Aug 24, 2007
    #1
    1. Advertising

  2. wrote:
    > Ideally, a servlet should be executed to do the business logic and
    > extract the data that will be displayed on showdata.jsp. Moreover, the
    > user may perform search in the child window, to filter or find the
    > results returned. My questions are as follows:
    >
    > 1. How to run servlet from Javascript that does the logic and then the
    > results are displayed in showdata.jsp (as a child window)?


    This question belongs more in the comp.lang.javascript newsgroup, but
    I'll do must to answer.

    The JavaScript should be as follows:
    function showResultsInWindow(page) {
    childwin.location.href = page;
    }

    > 2. How to go about filtering or finding results in showdata.jsp while
    > it is open ? what is the recommended method? because the results have
    > a check box next to them and when user choses and closes window they
    > are reported back to the main JSP which opened the child JSP.


    Not sure I understand your question. The answer appears to be either
    AJAX or table sorting. It depends on whether or not the information
    returned by showdata.jsp is sufficient to do the client-side filtering
    required.

    This question also seems to belong more in the c.l.javascript newsgroup.

    If needed, I can pull up two bouts of client-side filtering from one of
    my projects. One of them is sorting a table, and the other one is
    filtering divs based on their contents.

    > Any suggestions, reading materials, code , etc is very appreciated.


    Try poking around c.l.javascript.

    --
    Beware of bugs in the above code; I have only proved it correct, not
    tried it. -- Donald E. Knuth
     
    Joshua Cranmer, Aug 24, 2007
    #2
    1. Advertising

  3. Guest

    > This question belongs more in the comp.lang.javascript newsgroup, but
    > I'll do must to answer.
    >
    > The JavaScript should be as follows:
    > function showResultsInWindow(page) {
    > childwin.location.href = page;
    >

    Thank you very much for your reply . I have posted this question to a
    Javascript forum .... Just wonder if you could tell me how to run a
    servlet (and not a jsp page) from javascript.

    > 2. How to go about filtering or finding results in showdata.jsp

    while
    > > it is open ? what is the recommended method? because the results have
    > > a check box next to them and when user choses and closes window they
    > > are reported back to the main JSP which opened the child JSP.

    >
    > Not sure I understand your question. The answer appears to be either
    > AJAX or table sorting. It depends on whether or not the information
    > returned by showdata.jsp is sufficient to do the client-side filtering
    > required.
    >
    > This question also seems to belong more in the c.l.javascript newsgroup.
    >
    > If needed, I can pull up two bouts of client-side filtering from one of
    > my projects. One of them is sorting a table, and the other one is
    > filtering divs based on their contents.
    >


    Perhaps it will be clear with an example .... I have several text
    boxes that should be filled from some values that are extracted from
    database.

    Suppose I have textbox sport and textbox player
    Now if user clicks a link beside sport textbox, another window opens
    (by running servlet , forwarding results to showdata.jsp) . Now user
    will see list of options like basketball, football, etc. But the list
    could be long and I don't want him to scroll down the page and look
    for it. I would like to know if there is a good method to enable him
    to search in the same form that is displaying data.

    Thanks again
     
    , Aug 27, 2007
    #3
  4. wrote:
    ...
    >...I would like to know if there is a good method to enable him
    >to search in the same form that is displaying data.


    Yes. JavaScript is well suited to that type of task,
    so your post over on c.l.js should get it sorted.

    Of course, when posting to the JS group, it often pays to
    ignore the entire Servlet/JSP source of the data, and
    simply refer to it as a web page (HTML), since ultimately,
    HTML (with embedded scripts, or references to external
    scripts) is what is delivered to the browser.

    --
    Andrew Thompson
    http://www.athompson.info/andrew/

    Message posted via JavaKB.com
    http://www.javakb.com/Uwe/Forums.aspx/java-general/200708/1
     
    Andrew Thompson, Aug 27, 2007
    #4
  5. Lew Guest

    wrote:
    > Thank you very much for your reply . I have posted this question to a
    > Javascript forum .... Just wonder if you could tell me how to run a
    > servlet (and not a jsp page) from javascript.


    A JSP page /is/ a servlet!

    You invoke a servlet by using its URL as the target of a form POST.

    --
    Lew
     
    Lew, Aug 27, 2007
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bhchng
    Replies:
    0
    Views:
    686
    bhchng
    Jan 13, 2004
  2. Patrick Olurotimi Ige

    Closing child window when opening a new Window

    Patrick Olurotimi Ige, Dec 14, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    462
    Patrick Olurotimi Ige
    Dec 14, 2004
  3. UJ
    Replies:
    2
    Views:
    7,598
    John Timney \(ASP.NET MVP\)
    Jun 27, 2005
  4. Jeff Rodriguez
    Replies:
    23
    Views:
    1,207
    David Schwartz
    Dec 9, 2003
  5. Spammay Blockay
    Replies:
    1
    Views:
    533
    Dietmar Meier
    Feb 4, 2005
Loading...

Share This Page