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();">

Ads









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
Random classes
Random classes  Hello... What is Random class? What's the purpose
Advertisements
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
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
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
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
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
understanding data science
understanding data science  Hi, I am beginner in Data Science...: understanding data science Try to provide me good examples or tutorials links so that I can learn the topic "understanding data science". Also tell me which
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
A Program to find area and perimeter of Rectangle
A Program to find area and perimeter of Rectangle In this section we will explain you with the help of a program to find the area and perimeter of  a rectangle. To find area and perimeter of a rectangle is a simple program
Random in jsp
Random in jsp          Random numbers are the numbers that are determined entirely by chance. User does not have any control over the working of random numbers
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-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

Ads