JSP: Creating Dynamic Titles Rhode Island

Add flair to your Web site. Learn how to create dynamic titles using JSP.

Local Companies

Advantage Technologies Inc
(401) 490-2976
111 Waterman Ave
East Providence, RI
Profit Point Group Inc the
(401) 658-0772
2352 Mendon Rd
Cumberland, RI
J Partington & Company Inc
(401) 769-7800
25 John A Cummings Way
Woonsocket, RI
Micro Computer Associates
(401) 619-1915
1272 W Main Rd
Middletown, RI
Datajet
(401) 364-9050
70 Knauss Dr
Narragansett, RI
Chapman Software Designs
(401) 245-1936
37 Fern Dr
Warren, RI
Gemini Systems Inc
(401) 294-1619
625 W Allenton Rd
North Kingstown, RI
Internal Matters
(401) 739-3686
334 Knight St
Warwick, RI
Connekted Inc
(401) 886-5111
4547 Post Rd
East Greenwich, RI
Stenhouse Consulting
(401) 453-6900
4 Traverse St
Providence, RI

provided by: 
Originally published at Internet.com


One of the main advantages of JavaServer Pages is the ability to generate dynamic content. JSPs generate dynamic HTML pages by using Java control structures like for loops and if statements. As a result, forms can be generated dynamically following some specified logical layout.

Consider the simple task of generating a string repeatedly. This can easily be done by putting the string inside a for loop. The listing below provides a simple example of a JSP that generates a dynamic response to the user. The example consists of generating several progressively smaller HTML headers. Each header is lighter in color than the preceding one.

Listing: dynamicTitles.jsp

1: Dynamic Titles
2:
3:

4: <% String[] colorArray = { "00", "11", "22", "33",
5: "44", "55", "66", "77",
6: "88", "99", "AA", "BB",
7: "CC", "DD", "EE", "FF"};
8: for(int j=1; j<5; j++){
9: String fgColor = colorArray[j*3]+colorArray[j*3]+colorArray[j*3];%>
10: 11: 12: JSPs are great !!!
13:

14:
15: <% } %>
16:

17:

Line 4 declares a colorArray containing a hexadecimal color string. Color in HTML is defined as the combination of the colors red, green and blue. Each of these has hexadecimal values from 00 to FF (0 to 255 in decimal), and the three are combined by concatenating their values. So purple would be FF00FF, black would be 000000, white FFFFFF, and so on...

Read article at Internet.com site

Topics: 
Architecture & Design Languages & Tools Project Management Web Services
Database Microsoft & .NET Security Wireless
Java Open Source Techniques XML