• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

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

 
Ranch Hand
Posts: 763
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 763
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How do we make Ajax request just for text1 ?

I know only about request on click of SUBMIT button.
 
Sheriff
Posts: 67750
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
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: 763
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear

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

not getting any idea
 
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 763
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 763
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator




What will happend here
 
Jigar Naik
Ranch Hand
Posts: 763
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
its giving me error at


and this code is in my servlet

 
Bear Bibeault
Sheriff
Posts: 67750
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

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: 763
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
[Bear edit: snippy response removed]
[ January 10, 2007: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Sheriff
Posts: 67750
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
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.
 
That new kid is a freak. Show him this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic