• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Monica Shiralkar
Ranch Hand
Posts: 842
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 34669
366
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Monica Shiralkar
Ranch Hand
Posts: 842
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic