What is a JOptionPane in JSP?

I want to make, for example, JOptinonPane in JSP. What is equivalent to this JSP?

+4
source share
1 answer

First of all, JSP runs on a web server, creates HTML / CSS / JavaScript and sends it to the webbrowser. Webbrowser extracts HTML / CSS / JavaScript and interprets / applies / executes it. If the Java / JSP performed its task correctly, the web browser should not retrieve any line of Java / JSP code. Just because it does not understand. Right-click and select Source View. It will become clear. Does it have? :)

Now in a web browser you can use JavaScript to display dialogs. For instance. one-button dialog box:

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

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

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

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

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

Just write it on the JSP page in the usual way. JSP will send it to a web browser.

See also:


To take it one step further, you can use more advanced JavaScript and a good CSS snapshot in combination with the HTML <div> element to create a beautiful dialog box. You can find here a few examples based on the jQuery user interface.

+4
source

All Articles