Technology Software

How to Access a String Array in JSP

    • 1). Open a text editor like "WordPad." This text file will be where you place all of your source code. You will need to create the skeleton of a web page first. Write the following text inside the source code file:

      <HTML>

      <HEAD>

      <TITLE>Accessing an Array</TITLE>

      </HEAD>

      <BODY>

      <%

      %>

      </BODY>

      </HTML>

    • 2). Place all of the JSP code found in the following steps between the <% and %> symbols.

    • 3). Create an array of string named "cars." Then fill this string with a few different types of cares. Write the following at the top of the source code file:

      String[] cars = {"Lamborghini", "Porsche", "BMW"};

    • 4). Loop through the array of cars using a "for" loop which visits each member of an array once, so you can do something special like print out each car name. This requires accessing the array. Accessing an array is done by using the array name followed by the symbols []. The element of the array goes between these symbols. For example, to print out the fifth element of an array, you would write "arrayName[5]." To print out all the elements in the array, write the following statements:

      for (int i = 0; i < cars.length; i++) {

      out.print("<p>" + cars[i] + "</p>");

      }

    • 5). Save the file as "Array.html." View the file in a web browser.

Related posts "Technology : Software"

How to Capture Analog Audio on My Computer

Software

Effective Photoshop Training Course to Enhance Your Photos

Software

How To Use Softphone Software For Your Business

Software

How to Access a String Array in JSP

Software

How Do I Get a Reversible Reaction Arrow in Microsoft Word 2007?

Software

How to Get AVCHD (MTS) Files to My PC

Software

Beat Detective Region Conform Tips

Software

MS BKF Repair Tool to Fix Corruption Owing to FAT File System

Software

Making an ASM Comparison

Software

Leave a Comment