File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes display client side javascript messge 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 "display client side javascript messge "invalid user" based on server side response" Watch "display client side javascript messge "invalid user" based on server side response" New topic
Author

display client side javascript messge "invalid user" based on server side response

Monica. Shiralkar
Ranch Hand

Joined: Jul 07, 2012
Posts: 670
I have created a JSP page with login and password buttons. I am checking from database and if the user is invalid I am displaying "Invalid User"
but instead of this now i have to display a Javascript PopUp saying "Invalid User"
I know how to display alert message but invalid user is based on server response how to display client side javascript based on server side code?

thanks
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31062
    
232

It should be similar to how you are displaying the invalid user message now. Except you use that condition to generate JavaScript. You could use jQuery or an onload event so the alert gets displayed after the page loads.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Monica. Shiralkar
Ranch Hand

Joined: Jul 07, 2012
Posts: 670
I was trying this:

In the JSP page inside a scriplet check using JDBC whether user is valid or invalid.
If user is Invalid Call javascript with alert saying " Invalid User".
but problem I am facing is :javascript can be executed from within a JSP scriptlet code only on the occurence of some event
where as I want script to be called on a particular condition from scripet.

Please advice..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: display client side javascript messge "invalid user" based on server side response