• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

on lost focus of textbox. + JSP + Server side Validation.

 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have 2 textbox in my .JSP file.

text1 & text2

I will enter some value in text1 and when the focus of text1 is lost, I want to check the value in my database table wather it is in database or not.

can anybody suggest me on same.
What technique should i use ?
I don't have any idea of how to do it...
The database table contains more than 100000 entries for that field.
I'm Using MVC architecture...
 
Joel Jorgensen
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd strongly recommend making an Ajax request to the Controller, with the value of Text1. Configure the Controller so that it will pass the Text1 value to the Model, which should then verify whether the Text1 value is in the database and return true or false to the View.
[ January 08, 2007: Message edited by: Joel Jorgensen ]
 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do we make Ajax request just for text1 ?

I know only about request on click of SUBMIT button.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's the whole point of Ajax -- to make a request without submitting the page.

You can start reading about Ajax here.
 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear

The the link you gave me contains everything about xml parsing and all that...

not getting any idea
 
Muhammad Saifuddin
Ranch Hand
Posts: 1324
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jigar Naik:
The the link you gave me contains everything about xml parsing and all that... not getting any idea


Yeah Ajax is all about XHR(XMLHttpRequest) thats the only part is available to communicating with server without refreshing your page. check this link for more about Ajax with Steps for building your request(XHR).

hope it helps..
 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but in my very simple application which xml should i pass... ??? there is no xml file i m having which i can pass...

whats the role of xml file in my application if i use Ajax ?
 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator




What will happend here
 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
its giving me error at


and this code is in my servlet

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jigar Naik:
but in my very simple application which xml should i pass... ??? there is no xml file i m having which i can pass...

whats the role of xml file in my application if i use Ajax ?


There is no need to use XML with Ajax. You can return anything you want. Including a simple indication regarding whether validation passed or not.

Do some research. There are literally thousands of Ajax examples on the web.

There are also many books available.
[ January 10, 2007: Message edited by: Bear Bibeault ]
 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[Bear edit: snippy response removed]
[ January 10, 2007: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have removed the snippy response and ensuing replies and am closing this topic.

Jigar Naik, as a tip, you will find that being confrontational to those that are trying to help you is not a good recipe for making progress.

Moreover, one of the few rules here at the JavaRanch is "Be nice". I found your posts less than so.

If you would like to engage in a civil discussion of the merits or drawbacks of using formats other than XML with Ajax, please feel free to open a new topic on the subject. But be warned, further unpleasant posts will not be welcomed.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic