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

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

 
Ranch Hand
Posts: 2925
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 2925
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..
 
Replace the word "snake" with "danger noodle" in all tiny ads.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic