Image Source Google Images

                               This post describes the components of a jsp page. My last post I try to given introduction about jsp. This post some of the components I am introducing. And I never used any of the components also I created first Hello world JSP page for understanding. Later I can give each component based examples also. Please see simple video end of the post.

                                A Jsp contains HTML content,jsp tags and java code. By using jsp tags either we can embed java code directly into the jsp page or we can invoke the functionality of java code running behind the scenes. Java code is required for a jsp to provide dynamism to the web page.

Jsp tags can be classified into the following 3 categories.

1.       Scripting  Elements
2.      Directives
3.      Actions

Scripting Elements:- The basic functionality of scripting elements is to allow jsp authors to embed java code directly into the jsp. We can classify scripting elements as follows.

1.       Declaration
2.      Expression
3.      Scriptlet

Declaration:- A Jsp declaration lets us define methods or variables in jsp. These methods and variables become direct members of the container generated servlet class. We can define both instance and static members in a declaration. A declaration has the following form.

<%!
            //Java Variable declarations and method definitions
%>

For example

<%!
            Private int count=1;//instance variable definition
            Static int total;//static variable declaration
            Int getCount()//instance method definition
            {
                        Return count;
            }
            Static int getTotal()
            {
                        Return total;
            }
%>

Please see for better understanding JSP API click the following link



Post a Comment

 
Top