• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how a servlet can return value to a html?

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can make an Ajax request to the servlet.
 
Sachin Kadian
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i dont know about azax.. how can i use this please help..
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

harish Gunda wrote:You need to make ajax call using the XMLHTTPObject


It's XMLHttpRequest, not XMKHTTPObject.
 
reply
    Bookmark Topic Watch Topic
  • New Topic