aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes on lost focus of textbox. + JSP + Server side Validation. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "on lost focus of textbox. + JSP + Server side Validation." Watch "on lost focus of textbox. + JSP + Server side Validation." New topic
Author

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

Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 757
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...


Jigar Naik


Joel Jorgensen
Greenhorn

Joined: Oct 13, 2006
Posts: 22
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 ]

Go is to the fountain.
Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 757
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

Joined: Jan 10, 2002
Posts: 61413
    
  67

That's the whole point of Ajax -- to make a request without submitting the page.

You can start reading about Ajax here.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 757
Dear

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

not getting any idea
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

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..


Saifuddin..
[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 757
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

Joined: Dec 12, 2006
Posts: 757




What will happend here
Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 757
its giving me error at


and this code is in my servlet

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

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

Joined: Dec 12, 2006
Posts: 757
[Bear edit: snippy response removed]
[ January 10, 2007: Message edited by: Bear Bibeault ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: on lost focus of textbox. + JSP + Server side Validation.