Home | Ajax | BioInformatics | Dojo | EAI | EJB | Hibernate | J2ME | Java | Java Glossary | Java Servlets | JavaScript | Jboss | JDBC | JDO | Jmeter | JSF | JSP | JUnit | Maven | MySQL | Spring Framework | SQL | Struts | Technology | WAP | Web Services | XML
 
 
Search All Tutorials

 
Programming Tutorials: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML
 
JSP
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments

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.

                         

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

Current Comments

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

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

I want to write JSP.net pages using visual basic on tomcat. how can i do it using directives? Can i use page to redirect to a application server url which in turn calls the .net code and all this happens over tomcat.

Posted by Tamboo on Wednesday, 05.16.07 @ 01:05am | #16044

Hi i want to capture am image from webcam using JSP code.Is it possible.Can we embed Swings code inside the JSP.Pls post me related topic

Posted by Login on Saturday, 03.17.07 @ 22:57pm | #12021

hello sir i want the complete usage of eclipse in real time pls inform the details of the eclipse

Posted by jagadeesh on Wednesday, 02.28.07 @ 21:43pm | #9972

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

 

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.

Hot Web Programming Job

Java String toLowerCase Example
Java String toCharArray Example
Java String substring Example
Java String indexOf Example
Java String startsWith Example
Java String hashCode Example
Java String matches Example
Java String length Example
Java String lastIndexOf Example
Java String isEmpty Example
Java String equalsIgnoreCase Example
Java String equals Example
Java String endsWith Example
Java String copyValueOf Example
Java String contentEquals Example
  EAI Articles
  Java Certification
Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

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 © 2007. All rights reserved.