• Post Reply Bookmark Topic Watch Topic
  • New Topic

ALerts in jsp

 
monica arora
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)
 
ramprasad madathil
Ranch Hand
Posts: 489
Eclipse IDE Java Tomcat Server
  • 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.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!