Local HTML to Servlet Communication


General J2EE: Local HTML to Servlet Communication

  1. Local HTML to Servlet Communication (1 messages)

    Hi Experts

    I am having a local HTML file. I am passing some parameters from the HTML to Servlet. This am able to do it. Now I want to display the servlet response on one Textbox in my local HTML.

    Could somebody help me out regarding this implementation.

    Warm Wishes
  2. What exactly do you mean with "local HTML"? Is it not part of the application with the servlet? Since the servlet generates the response itself, there are two way to handle this:

    1. Rewrite the application by changing the HTML page to a JSP page and remove the servlet (have the JSP page server the requests from itself)

    2. Have a hidden frame which calls the servlet (you'll have to do this in javascript in your HTML page), then the javascript gets the response from the hidden frame and shows it in the HTML page. A bit tricky since the call in the hidden fram will happen in a separate thread from the javascript so you need to implement some type of "listener" analogy.