Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSP-Servlet Printing the integers before and after

Have Programming Question? Ask it here!
 
 
 


Tan BS
Printing the integers before and after
1 Answer(s)      4 years and 9 months ago
Posted in : JSP-Servlet



Advertisement
View Answers

November 11, 2009 at 2:56 PM


Hi Friend,

Try the following code:

<%@ taglib uri="http://java.sun.com/jstl/core_rt"; prefix="c" %>
<%@ page import="java.util.*"%>
<% Random r=new Random();
int num = r.nextInt(10);
System.out.println(num);
int pno=num-1;
int nno=num+1;
%>
<html>
<body>

<c:set var="guess" value="<%=num%>"/>
<b>Random Numbers is </b>
<c:out value="${guess}"/>

<br/>
<c:if test="${(guess %2== 0)}">
<b>It is an even number lies between <%=pno%> and <%=nno%></b><br/>
</c:if>
<c:if test="${(guess %2!= 0)}">
<b>It is an odd number lies between <%=pno%> and <%=nno%>.</b><br/>
</c:if>

</body>
</html>

Thanks


Related Tutorials/Questions & Answers:
Printing the integers before and after - JSP-Servlet
Printing the integers before and after  Hi, I'm trying to print out the integers before and after generated random number, and also stating it as either even or odd, but it does not seem to work. Pls advise on my code below
there extra space before or after my table.
there extra space before or after my table.  Why is there extra space before or after my table
Advertisements
integers
integers  an application that finds the smallest of several integers. assume the first value read specifies the number of values to input from the user. please help
INTEGERS
application that will input the kms driven and litre of fuel used (both as integers
Updating variables in a loop? and only printing certain messages after the first iteration?!
Updating variables in a loop? and only printing certain messages after the first iteration?!  I've written a program that reads two values. I... and ratios. So effectively at every calculation except the first, I would be printing
Sum of integers
the user and displays i) the sum of all even integers between 1 and the input value, both inclusive. ii) The sum of all odd integers between 1 and the input value both inclusive Example: User enters 7. Sum of even integers = 2+4+6 = 12 Sum
printing in swing
printing in swing  How can i print payslip in swing
Integers separated by a ", " in a string
Integers separated by a ", " in a string  How do I get integers separated by a ', ' in C++ in a string? Ex. string=1, 2, 3; //something to find the integers and put them in array a cout< output: 123   Hi Friend
applet printing
applets gridwise and in each applet i am drawing some graph so while printing whole... but while printing it is not getting printed on paper and rest everything it is printing
printing in java
printing in java  hello i want to print a jInternalframe containing some lebels,but my printer sent me a paper with the following written on it: please what is the problem
Create After Update Trigger in SQL
Create After Update Trigger in SQL       After Trigger in SQL is fired before update... illustrate an example from 'Create After Update Trigger in SQL'. In order
Printing stars
Printing stars  I am a beginer and i have one assignment which couldnt give me any idea how to do it..The Question is "Get a string "001222014654" and print o/p as 0 - * 1- ** 2- * 4- ** 5-* 6-* I dont know how to split
how to find [count the number of integers whose value is less than the average value of the integers]
how to find [count the number of integers whose value is less than the average value of the integers]  Construct an algorithm that will prompt... of 999 is entered. After the sentinel has been entered, display the total payroll
Printing numbers up to N into a file
Printing numbers up to N into a file  I'd like to print the first N integers, that is, "1, 2, 3, 4, ..., N-1, N", say N equals 1000, or 10000 or whatever. I'd also like to have the result stored as a file instead of having
Java program for printing document
Java program for printing document  can u send me the java program for printing the office document? email: ibrahimbest@gmail.com
printing java series
printing java series  * *** ***** ******** ***** *** *   Post the format properly
Program to read 2 integers using oops concepts
Program to read 2 integers using oops concepts  Write a program to read two integers with the following significance. ? The first integer value... notation, in this case 1630 which is the time 3 hours and 45 minutes after 12.45.
how to find the sum of integers in a string of sentence in java
how to find the sum of integers in a string of sentence in java  how to find the sum of integers in a string of sentence in java for e.g:--> abc d 2 3 21 the output should be 2+3+21=26
Printing server information
Printing server information  Hello, I am learning PHP language. I trying to fetch the server Information Print. How could i will printing the server... connected to your PC? This it best example for the Printing server Information
printing example - Java Beginners
printing example  Is it possible to print java controls using print method? My problem is to print a student mark list using java? The mark list should like that of university mark list
java matching array of integers - Java Beginners
token is assigned a vlaue in integers and stored in an array. the consecutive array of integers occurring similarly have to be found out. and depending upon... for finding similar consecutive array of integers
Java Printing - Java Beginners
Java Printing  Can anybody plz help in giving the code for printing the contents of JPanel.. It contains JLabels and JTextFields only.. Plz.. Its urgetn.. Printing means sending the document to the Printer..  Hi Friend
What is 3D Printing?
3D printing is one of those technologies that made manual job with the objects... used to know and interact with just a few decades before has changed beyond... and in the meantime we lose the erstwhile sense of solid sensory reality. 3D printing
Mangling Integers,java,java newsletter,tutorial
Mangling Integers 2005-01-31 The Java Specialists' Newsletter [Issue 102] - Mangling Integers Author: Dr. Heinz M. KabutzJDK version: Sun JDK 1.5.0_01... and welcoming. Mangling Integers When I was a kid, I enjoyed
printing hollow square
printing hollow square  Write an application (PrintingSquares.java) that prompts the user to enter the size of the side of a square, then displays a hollow square of that size made of asterisks. Your program should work
how printing landscape?
how printing landscape?  I have code which print some data from data base with "drawString()" and it works correct when I chose "Portrait" from "Print Dialog", but it does not work if chose "Landscape". Is any way to print
Printing ArrayList - JSP-Servlet
Printing ArrayList   I have a code in servlet like this ArrayList total = new ArrayList (); session.setAttribute("efg",total); RequestDispatcher rd; rd = request.getRequestDispatcher("/checkout.jsp"); rd.forward
printing series in java
printing series in java  1 123 12345 1234567 12345 123 1   Here is a code for the following pattern: 1 123 12345 1234567 12345 123 1 class Pattern{ public static void main(String[] args
Printing 2 arrays
Printing 2 arrays  Hi, I have 2 arrays: String [] head = {"Name", "Date of birth", "PPS number"}; String [] personal= {value1, value2, value3}; I want this 2 arrays to be printed out in the following manner: head[0] tab
validate parameter before using it
validate parameter before using it   How to validate the parameter before using it in JSP
convertion before downloading
convertion before downloading  convert zip file which is in server to doc while before downloading
printing the following output using for loop
printing the following output using for loop  1 2 3 3 4 5 4 5 6 7
printing the following output using for loop
printing the following output using for loop  1 2 3 3 4 5 4 5 6 7
rename before uploading
rename before uploading  I need to change (rename)the file name/image name before uploading it so that the file gets uploaded on server with this new name
Printing Session Id Using Variable
Printing Session Id Using Variable  Hi, I am a learner in PHP language. Could any one guide me, how to print session Id using variable in PHP. Thanks
Integers
Java NotesIntegers Integers are whole numbers, for example, -35, 0, 2048, .... Integers are represented in binary inside the computer, and in decimal... of primtive integers and two integer classes. Primitive types. The are four types
patterns printing using for loop in java
patterns printing using for loop in java  how to write the code for the pattern as: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
JFrame Components Printing - Swing AWT
JFrame Components Printing  hi sir i am doing a project so i am working in netbeans i have to print a JFrame it contains Labels and few textboxfields so i want to take the whole JFrame contents for printing so would you
java web application printing - WebSevices
into a notepad document on client side with proper formatting to help printing
settings in control panel before jdbc
settings in control panel before jdbc  do we need to do any settings in the control panel before starting jdbc?   Hello Friend... the driver Microsoft Access Driver(*.mdb). 3)After selecting the driver, click finish
Printing Values of Resultset to Html Table
Printing Values of Resultset to Html Table  I have a resultset and I need to collect the resultset values into the arraylist into a table. arraylist also contains timestamp values. Please help me in this regards Thanks
validating a form before data is entered.
validating a form before data is entered.  How can I avoid validating a form before data is entered
JFrame components printing - Swing AWT
(String[] args) { new PrintExample(); } public PrintExample() { super("Printing
JFrame components printing - Swing AWT
(String[] args) { new PrintExample(); } public PrintExample() { super("Printing
JFrame Components Printing - Swing AWT
PrintExample() { super("Printing Swing Components
Eclipse helios "Build Before Launch"
Eclipse helios "Build Before Launch"  Hi The IDE Eclipse Helios present having an issue related to ?Build before Launch?. it still tries to build... Disable the build-before-launch. Select "Window->Preferences
Eclipse helios "Build Before Launch"
Eclipse helios "Build Before Launch"  Hi The IDE Eclipse Helios present having an issue related to ?Build before Launch?. it still tries to build... the build-before-launch. Select "Window->Preferences
printing records from jsp - JSP-Servlet
printing records from jsp  Hi Plz tell me how to printing out pages from jsps with page numbers Thank you  Hi friend, For paging in Jsp visit to : http://www.roseindia.net/jsp/paging.shtml http
 

 

 

DMCA.com