The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> Java Help
|
How can I call a servlet from html page?
Discuss How can I call a servlet from html page? in the Java Help forum on Dev Shed. How can I call a servlet from html page? Java Help forum discussing all Java platforms - J2ME, J2SE and J2EE - as well as relevant standards, APIs and frameworks such as Swing, Servlets, JSPs, Applets, Struts, Spring, Hibernate, ANT, EJB, and other Java-related topics.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

March 6th, 2001, 09:41 AM
|
|
Junior Member
|
|
Join Date: Mar 2001
Location: Russia
Posts: 0
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
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.
|

March 7th, 2001, 12:36 AM
|
|
Junior Member
|
|
Join Date: Dec 2000
Location: Ahmedabad,Gujarat,India
Posts: 2
Time spent in forums: < 1 sec
Reputation 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.
|

March 7th, 2001, 08:43 AM
|
|
Junior Member
|
|
Join Date: Mar 2001
Location: Russia
Posts: 0
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
ajitrm, DON'T RELOAD THE PAGE!!!
|

March 8th, 2001, 04:52 AM
|
|
Junior Member
|
|
Join Date: Dec 2000
Location: Ahmedabad,Gujarat,India
Posts: 2
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
I don't understand what u mean by not reloading. U have written about reloading not me.
|

March 8th, 2001, 12:28 PM
|
|
Junior Member
|
|
Join Date: Mar 2001
Location: Russia
Posts: 0
Time spent in forums: < 1 sec
Reputation 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!
|

March 15th, 2001, 06:49 AM
|
|
Junior Member
|
|
Join Date: Mar 2001
Posts: 0
Time spent in forums: < 1 sec
Reputation 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!
|

March 15th, 2001, 06:59 AM
|
|
Junior Member
|
|
Join Date: Mar 2001
Location: Russia
Posts: 0
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Torakh, good idea.
Anybody else?
|

March 15th, 2001, 02:24 PM
|
|
Contributing User
|
|
Join Date: Mar 2001
Location: Dublin
Posts: 413
Time spent in forums: 2 h 18 m 18 sec
Reputation Power: 13
|
|
|
Lots of javascript options...
Do you need to be cross-browser compatible?
Do you need to receive information or just send it?
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|