Jsp Tutorial Home

Jsp Home

JSP Resources

Community

Site

Creating your second JSP page

text zoom

Creating your second JSP page


For the second example,we will make use of the different tags we have learnt. This example will declare two variables; one string used to stored the name of a website and an integer called counter that displays the number of times the page has been accessed. There is also a private method declared to increment the counter. The website name and counter value are displayed.


 



<HTML>

<HEAD>

<!-- Example2 -->

<TITLE> JSP loop</TITLE>

</HEAD>

<BODY>

<font face=verdana color=darkblue>

JSP loop

<BR> <BR>

<%!

public String writeThis(int x)

{

            String myText="";

            for (int i = 1; i < x; i++ )

                       myText = myText +  "<font size=" i " color=darkred face=verdana>VisualBuilder JSP Tutorial</font><br>" ;

            return myText;

}

%>




This is a loop example from the


<br>

<%= writeThis(8) %>

</font>

</BODY>

</HTML>




                    

Copyright © 2013 VisualBuilder. All rights reserved