File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Alert 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 "Alert" Watch "Alert" New topic


rose hegde
Ranch Hand

Joined: Oct 22, 2003
Posts: 40
Through java code i want to display alert box.
A value is checked for from database and if its greater a alert box has to be displayed.
Like i display it on java console using System.out.println...i want to display in the form of alert box when assessing from jsp file.
jyothsna kumari
Ranch Hand

Joined: Jul 21, 2003
Posts: 108
from server side java u cannot show the alert box directly.if u want u can pass a value to the jsp form and check for that value in body onload.if it is set u can show the alert box.on client side java u can call a function on checkbox being that u can call a alert box.
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
You can also manipulate the body tag of the generated HTML page to show a Javascript alert with a custom text in its onload argument.

Mathias Nilsson
Ranch Hand

Joined: Oct 13, 2003
Posts: 107
you can do this using a hidden Frame.
Let's say you have a frameset. You make one frame 1x1 px; when you
press a button from let's say frame "a" then send a query to the hidden frame.
Make the process with database query and just do an
document.form[ "a" ].showAlert( "Message" );
You can't do it from the same frame without reloading the page. using this technique you don't have to reload the frame visible for the user. If you want it more dynamic use java applet.
// Mathias

SCJP2 , MCP( 70-229 ) , Preparing For SCWDC
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63865

It's clear that this is much more of an HTML/Javascript question than one on JSP, so I'm moving it accordingly.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Alert
It's not a secret anymore!