Home Jsp JSP Create Variable



JSP Create Variable
Posted on: June 16, 2009 at 12:00 AM
JSP Create Variable is used to create a variable in jsp

JSP Create Variable

        

JSP Create Variable is used to create a variable in jsp. The scriptlets include a java code to be written as <%! %> provided by the jsp.

Understand with Example

The Tutorial illustrate an example from 'JSP Create Variable'. To understand the example we create an array variable of string type where we have defined the days of week and it is written inside the scriptlets. The for loop inside the scriptlet execute the loop repeatedly till the integer i  become less than length of days. Finally the out.println print the days in a week.

 

 

 

Here is the code of variable.jsp

<html>
<body>
<h1>Create Variable</h1>
<%
String days[] = {"Sunday","Monday","Tuesday",
 "Wednesday","Thursday","Friday","Saturday"};
out.println("Days of week= ");
for(int i=0;i<days.length;i++){
out.println(days[i]);
}
%>
</body>
</html>

Output will be displayed as:

Download Source Code:

 

Related Tags for JSP Create Variable:
javacjspidescriptincludeipviidjstoeitinasletjclscriptletprosspinccodcodewrittenvattscrssriripthavprodeo


More Tutorials from this section

Ask Questions?    Discuss: JSP Create Variable  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.