understanding buttons :JSP random no program

understanding buttons :JSP random no program

I hav java random no generator program but i need to implement it in JSP such that page generates random no between 100 and 200 on loading and on clicking submit button it ives message box or just shows on page "no is less"if it less then 150 else shows "no is greater" please help me to understand buttons .thank you java code for random no generation:

public class TestRandom
{
   public static void main(String args[]){
        Random r = new Random();
        int start = 100, end = 200; //The random number will be between 100 and 200
        for(int i=0;i<10;){ //suppose here 10 numbers ll be generated
            int rand = r.nextInt();
            if(rand>100 && rand<200){
                System.out.println(rand);
                i++;
            }
        }
    }
}
View Answers

March 9, 2011 at 11:22 AM

program to generate 1 random no

public class TestRandom
{
   public static void main(String args[]){
        Random r = new Random();
        int start = 100, end = 200;
        if(rand>100 && rand<200){
                System.out.println(rand);
                i++;
            }
        }
    }
}

March 9, 2011 at 12:17 PM

<html>
<script>
function set(){
 var r = Math.floor(Math.random()*200)+100  
document.getElementById("num").value=r;
}
function check(){
var n=document.getElementById("num").value;
if(n>150){
    alert("Number is greater");
}
else{
    alert("Number is lesser");
}
}
</script>
<body onload="set();">
Enter Number: <input type="text" id="num"><br>
</body>
<input type="button" value="check" onclick="check();">









Related Tutorials/Questions & Answers:
understanding buttons :JSP random no program
understanding buttons :JSP random no program  I hav java random no generator program but i need to implement it in JSP such that page generates random no between 100 and 200 on loading and on clicking submit button it ives
Understanding Hello World Java Program
Understanding Hello World Java Program       Now you are familiar with the Java program. In the last lesson you learned how to compile and run the Java program. Before
Advertisements
random number
random number   Please How do I generate a program that gives me random integer from 115 to 250? Using java.util.random. Thank you very much! á... main(String[] args){ int min = 115; int max = 250; Random random
Random classes
Random classes  Hello... What is Random class? What's the purpose
Random classes
Random classes  Hello... What is Random class? What's the purpose
Random classes
Random classes  Hello... What is Random class? What's the purpose
MySQL random number
MySQL random number       You may fall in the condition when you want to create random number for your program to process some logic, here is the solution for such condition. You can
random number
random number  Sir could u please send me the code registration form of roseindia.net with image varification
ModuleNotFoundError: No module named 'query-understanding'
ModuleNotFoundError: No module named 'query-understanding'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'query-understanding' How to remove the ModuleNotFoundError
program
program  how to improve programming skills plss tell some tips..i am understanding concepts but unable to write program so,pls give some guideness plsss
random numbers
random numbers  hi.. i am creating a website and on feedback form to authenticate user i want to generate a random number on label.if user types that number correctly in textbox then he is allowed to submit feedback otherwise
random numbers
random numbers  Hi I need some help with the code for the this program. This program should randomly choose a number between 1 and 1000, and then challenge the user to guess what it is, giving hints ('too high!' or 'too low
demonstrating understanding of data types
demonstrating understanding of data types  Design and implement a Java program that will gather a userÔ??s first name, middle initial, lastname, age in years, and 3 lucky numbers. The program should output the following based
random numbers - Java Beginners
random numbers  write a program to accept 50 numbers and display 5... java.util.*; class RandomNumberExample { static Random generator = new Random...(); System.out.println("Random numbers are: "); int random[]=new int[5]; for(int i=0;i
Random in jsp
Random in jsp          Random numbers are the numbers that are determined entirely... random number will be generated. The code of the program is given below:  ADS
Pick at Random
the entry from the array before selecting another name at random
Random Access File.
Random Access File.  Explain Random Access File
ModuleNotFoundError: No module named 'java-random'
ModuleNotFoundError: No module named 'java-random'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'java-random' How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'micropython-random'
ModuleNotFoundError: No module named 'micropython-random'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'micropython-random' How to remove the ModuleNotFoundError: No module
ModuleNotFoundError: No module named 'mkl-random'
ModuleNotFoundError: No module named 'mkl-random'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'mkl-random' How to remove the ModuleNotFoundError: No module named 'mkl
ModuleNotFoundError: No module named 'pulumi-random'
ModuleNotFoundError: No module named 'pulumi-random'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'pulumi-random' How to remove the ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'random_cli'
ModuleNotFoundError: No module named 'random_cli'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'random_cli' How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'random_color'
ModuleNotFoundError: No module named 'random_color'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'random_color' How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'random-dog'
ModuleNotFoundError: No module named 'random-dog'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'random-dog' How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'random-string'
ModuleNotFoundError: No module named 'random-string'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'random-string' How to remove the ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'random_instances'
ModuleNotFoundError: No module named 'random_instances'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'random_instances' How to remove the ModuleNotFoundError: No module
ModuleNotFoundError: No module named 'random_json'
ModuleNotFoundError: No module named 'random_json'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'random_json' How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'random-pesel'
ModuleNotFoundError: No module named 'random-pesel'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'random-pesel' How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'random-plus'
ModuleNotFoundError: No module named 'random-plus'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'random-plus' How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'random-profile'
ModuleNotFoundError: No module named 'random-profile'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'random-profile' How to remove the ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'random-proxy'
ModuleNotFoundError: No module named 'random-proxy'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'random-proxy' How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'random-script'
ModuleNotFoundError: No module named 'random-script'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'random-script' How to remove the ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'random-useragent'
ModuleNotFoundError: No module named 'random-useragent'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'random-useragent' How to remove the ModuleNotFoundError: No module
ModuleNotFoundError: No module named 'random-username'
ModuleNotFoundError: No module named 'random-username'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'random-username' How to remove the ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'random-warp'
ModuleNotFoundError: No module named 'random-warp'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'random-warp' How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'random-xe'
ModuleNotFoundError: No module named 'random-xe'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'random-xe' How to remove the ModuleNotFoundError: No module named 'random
ModuleNotFoundError: No module named 'sample-random'
ModuleNotFoundError: No module named 'sample-random'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'sample-random' How to remove the ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'java-random'
ModuleNotFoundError: No module named 'java-random'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'java-random' How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'java-random'
ModuleNotFoundError: No module named 'java-random'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'java-random' How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'micropython-random'
ModuleNotFoundError: No module named 'micropython-random'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'micropython-random' How to remove the ModuleNotFoundError: No module
ModuleNotFoundError: No module named 'pulumi-random'
ModuleNotFoundError: No module named 'pulumi-random'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'pulumi-random' How to remove the ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'pycopy-random'
ModuleNotFoundError: No module named 'pycopy-random'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'pycopy-random' How to remove the ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'pytest-random'
ModuleNotFoundError: No module named 'pytest-random'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'pytest-random' How to remove the ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'random-audio'
ModuleNotFoundError: No module named 'random-audio'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'random-audio' How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'random-cat'
ModuleNotFoundError: No module named 'random-cat'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'random-cat' How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'random-dict'
ModuleNotFoundError: No module named 'random-dict'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'random-dict' How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'random-episode'
ModuleNotFoundError: No module named 'random-episode'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'random-episode' How to remove the ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'random_flavorpack'
ModuleNotFoundError: No module named 'random_flavorpack'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'random_flavorpack' How to remove the ModuleNotFoundError: No module
ModuleNotFoundError: No module named 'random_name'
ModuleNotFoundError: No module named 'random_name'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'random_name' How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'random_password'
ModuleNotFoundError: No module named 'random_password'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'random_password' How to remove the ModuleNotFoundError: No module named

Ads