Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions? | Software Development
 

Nested If Statement

Nested If statement means to use the if statement inside the other if statement. Here we are providing you an example using Nested-If statement.

Nested If Statement

                         

In this section you will study about the Nested-if Statement in jsp.

Nested If statement means to use the if statement inside the other if statement. Here we are providing you an example using Nested-If statement. In the example, we want to display the reciprocal of a number only if that number is positive. So, an integer variable number is initialized to 4.

Here is the code of nestedIf.jsp

<HTML>
<HEAD>
<TITLE>Nested if Statement Example</TITLE>
</HEAD>

<BODY>
<H2>Nested if Statement Example</H2>
<%
double number = 4;

if (number != 0) {
if (number> 0){
out.println("The result = " + (1 / number));
}
else
out.println("A positive number is required.");
}
%>
</BODY>
</HTML>

Output will be displayed as:

Download source Code

                         

» View all related tutorials
Related Tags: java html c web jsp dynamic static script servlet sed ip page tag this log tar close js start technology

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

1 comments so far (
post your own) View All Comments Latest 10 Comments:

hi...i think it would be very helpfull if you can come out with simple examples where people can understand easily... thank u...

--adios--

Posted by indhu on Sunday, 01.24.10 @ 22:41pm | #94277

 
Tell A Friend
Your Friend Name

 

 
Recently Viewed
Software Solutions
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.