tags:

views:

30

answers:

1

I want to make such as JOptinonPane in JSP. What is the equivalent of it JSP?

+4  A: 

First of all, JSP runs at the webserver, produces HTML/CSS/JavaScript and sends it to webbrowser. Webbrowser retrieves HTML/CSS/JavaScript and interprets/applies/executes it. If Java/JSP has done its task right, the webbrowser should not retrieve any line of Java/JSP code. Simply because it doesn't understand it. Rightclick page and choose View Source. It'll become clear. Does it? :)

Now, in a webbrowser you can use JavaScript to show dialogs. E.g. an alert dialog with one button:

<script>alert('An alert message');</script>

A confirmation dialog with two buttons (which returns true or false depending on button pressed):

<script>var confirm = confirm('Are you sure?');</script>

A prompt dialog message with two buttons (which returns the input or nothing depending on button pressed):

<script>var input = prompt('Enter input', '');</script>

Just write it down in the JSP page the usual way. JSP will send it to the webbrowser.

See also:


To get a step further, you can make use of more advanced JavaScript and a good shot of CSS in combination with a HTML <div> element to create a nice-looking dialog. You can find here some examples based on jQuery UI.

BalusC
Many thanx Mr BalusC , what u said here'You can find here some examples based on jQuery UI.' is what exactly what i want.
Alaa
You're welcome.
BalusC