Share on Google+Share on Google+

JSP Create Variable

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

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

Output will be displayed as:

Download Source Code:



Posted on: June 16, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Discuss: JSP Create Variable  

Post your Comment

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