File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how a servlet can return value to a html?

 
Sachin Kadian
Ranch Hand
Posts: 33
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey all

please help me in following

I want to have an HTML page called SignUp.html and a servlet called CheckValidation.java


now there is a textBox in HTML called UserName.

CheckValidation just check whether the username the user entered is available or not. it have the connection with database and if the username is already present in the database then it must return that the usename is not available.

i want that UserName text onBlur event call that servlet and check the availability of username and write it in the lable next to username.

i can put tha servlet in onBlur event of the username but the problem is that how the servlet will retrun the value to that html??

Can a Servlet return any value to an HTML page? if yes then how can the html page can get it. ? if no then please suggest me any other way to do this.

thanhx.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64185
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can make an Ajax request to the servlet.
 
Sachin Kadian
Ranch Hand
Posts: 33
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i dont know about azax.. how can i use this please help..
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64185
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ajax, not azax.

The servlet can return any text value as the response.

If you don't know anything about Ajax, what did you mean by:
i can put tha servlet in onBlur event of the username
 
harish Gunda
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to make ajax call using the XMLHTTPObject and then get the response.
First create a xmlHTTPObject. set the input parameter and make the request to the servlet.

check this.

http://www.degraeve.com/reference/simple-ajax-example.php
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64185
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
harish Gunda wrote:You need to make ajax call using the XMLHTTPObject

It's XMLHttpRequest, not XMKHTTPObject.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic