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

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials:
 

Software Solutions and Services
 

 
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments
 
Introduction to JSP Declaratives Declarations 
 

Introduction to JSP Declaratives Declarations INTRODUCTION TO JSP DECLARATIVES Syntax of JSP Declaratives are: <%! //java codes %> JSP Declaratives begins with <%! and ends %> with .We can embed any amount of java code in the JSP Declaratives.

 

INTRODUCTION TO JSP DECLARATIVES

                         

Syntax of JSP Declaratives are:

  <%!
  //java codes
   %>

JSP Declaratives begins with <%! and ends %> with .We can embed any amount of java code in the JSP Declaratives. Variables and functions defined in the declaratives are class level and can be used anywhere in the JSP page.

Example:

 

 

 

<%@page contentType="text/html" %>

<html>

<body>

<%!
int cnt=0;
private int getCount(){
//increment cnt and return the value
cnt++;
return cnt;
}
%>

<p>Values of Cnt are:</p>

<p><%=getCount()%></p>

<p><%=getCount()%></p>

<p><%=getCount()%></p>

<p><%=getCount()%></p>

<p><%=getCount()%></p>

<p><%=getCount()%></p>

</body>

</html>

The above example prints the value of variable cnt.
To execute the code click below.

Execute the example.

                         

» View all related tutorials
Related Tags: c exception error jsp io count page using invoke js handle if to ci counter e directive can pe ce

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

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

The message which is given on Jsps are more usefull and thank full to everyone.

Posted by raghunath bj on Sunday, 12.14.08 @ 04:06am | #82736

good example

Posted by VERY GOOD on Monday, 12.1.08 @ 03:53am | #82225

I am really intrested.And would like to know in more .Please provide those details with screenshots.

Posted by J2ee sucks on Friday, 09.12.08 @ 10:42am | #78839

this is the project i hve to do in jsp platform
that estimation of leather product with inventory check

If anybody intrested to help me i will send u the detail description
This my MCA proj

Posted by sundari on Saturday, 02.9.08 @ 09:18am | #47662

i want to use resultSet object in javascript function. The function is called useing onchange="functionname()"
using jsp tags

Posted by kishore on Friday, 02.1.08 @ 17:20pm | #46864

have anyone heard about the tag called <taloginContble>.. what does it mean...if know, respond me ..
i hope u guys consider this and help me too..

Posted by dhinesh kumar on Monday, 01.14.08 @ 12:21pm | #45165

If someone can give more examples of all the concepts of jsp.

Posted by sam on Wednesday, 10.10.07 @ 17:10pm | #33008

Hi,
Plz inform the details of the Eclipse.

Posted by Krishna on Friday, 07.6.07 @ 10:04am | #20818

Hi,

I will be using 6230i phone as a modem connected to the computer via USB cable. U guys know to connect the apache tomcat v5.5 to the phone-modem. I know i need a interface to connect them together, but, cant managed to find it.

Hope u guys could help out.

thx.

Posted by Kobe on Thursday, 07.5.07 @ 12:51pm | #20758

download it from apachesoftware foundation

from apache.org

Posted by vivek kumar on Wednesday, 05.30.07 @ 19:19pm | #17744

Training Courses
Tell A Friend
Your Friend Name
Website Designing Services
 
Web Designing Packages From $150!
 
Website Designing Company Web Hosting
 
Website Designing Quotation
 
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

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

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

Copyright © 2008. All rights reserved.