• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

ALerts in jsp

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ranchers....
may be it is silly question i m asking....but please friends consider it
actuly i m new to jsp.
can any one tel me how can i show alerts in a jsp.
for example a login page whenever a wrong id or password encounters in jsp
it must show a n alert for wrong user and remain on the same jsp.
please friends m waiting 4 ur reply
monica(mona)
 
Ranch Hand
Posts: 489
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


it must show a n alert for wrong user and remain on the same jsp.



Minor correction - it would remain on the same htnl page - not the jsp. Jsps are executed on the server and the result of this is html content which is then sent to the browser.

Ideally you would use a Servlet to check for the correctness of the username and the password. The servlet would then forward to the appropriate jsps which will then output the html.

To display an alert popup message, you'll have to include a small javascript content along with the html in your jsp.

ram.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no such thing as an 'alert' in JSP because JSP is executed up on a server. The output of a JSP is generally HTML and Javascript.

You can achieve the results you've asked about by printing javascript output to the page.
 
I don't always make ads but when I do they're tiny
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps
https://coderanch.com/t/722574/Sauce-Labs-World-Largest-Continuous
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!