#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Location
    Russia
    Posts
    0
    Rep Power
    0

    Post


    Sorry for my English(I am from Russia).
    I have one small question:
    how can I call a servlet from html page, but not reload this page?
    (not using frame and applet, this is a plain html page)

    In principle, I have answer to this question, but I want to hear more versions of solving this problem.

    Thank you.
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2000
    Location
    Ahmedabad,Gujarat,India
    Posts
    2
    Rep Power
    0
    If u r using a servletrunner, then u can call the servlet from the html like this:
    If u have a form inside the html, u r form tag will look like this:
    <form action="http://localhost:8080/servlet/servletname" method=post>

    This will ensure that only post requests can be sent. So u can't reload the serlvet.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Location
    Russia
    Posts
    0
    Rep Power
    0
    ajitrm, DON'T RELOAD THE PAGE!!!
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2000
    Location
    Ahmedabad,Gujarat,India
    Posts
    2
    Rep Power
    0
    I don't understand what u mean by not reloading. U have written about reloading not me.

  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Location
    Russia
    Posts
    0
    Rep Power
    0
    Usually, when you send data on the server, then your web-page (html-page) is REFRESHED(updated, RELOAD, renew). But I want to send data on the server without REFRESHING this page.

    My english is very bad!
  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Posts
    0
    Rep Power
    0
    Hi!

    One idea is to have the <form>-tag which calls the servlet in a separate "invisible" frame, i.e <frameset cols="100%,*">, and have a JavaScript alter and submit the form when some event is triggered. This way, the shown HTML-page won't be reloaded/refreshed.

    (Other methods than using a form is possible with JavaScript...)

    Hope this helps!
  12. #7
  13. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Location
    Russia
    Posts
    0
    Rep Power
    0
    Torakh, good idea.

    Anybody else?
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Location
    Dublin
    Posts
    413
    Rep Power
    14
    Lots of javascript options...
    Do you need to be cross-browser compatible?
    Do you need to receive information or just send it?

IMN logo majestic logo threadwatch logo seochat tools logo