• Jsp scripting elements are used to embed jva code in to the jsp.
  • Jsp scripting elements are three types
    1. Declaration
    2. Expression
    3. Scriplet

Jsp Declaration:

  • Jsp declaration is one of the three scripting elements.
  • it is used to embed java code into the jsp
  • A Jsp declration starts with "<%!" and ends with "%>".
  • <%! int a%>.
  • Instance variables, instance methods, static methods can be declared and defined in ajsp declaration.
  • During translation time of jsp they became members of container generated servlate/page implementation class.

Jsp Expression:

  • Jsp Expression is one of the three scripting elements.
  • it is used to embed java code into the js.
  • A jsp expression starts with "<%=" and ends with "%>".
  • <%=a+b%>
  • within a Jsp expression only one java expression that too without semicolon is placed.
  • When Jsp expression is evaluated two thing will happen in the backend
    1. Java expression is evaluated
    2. The result is sent to the browser stream.
  •  we can have any number of jsp expressions in ajsp.
  • During translation phase each java expression of a jsp expression is placed in into _jspService()
    method of page implemented class


Jsp Scriplet:

  • Jsp scriplet is one of the three scripting elements.
  • it is used to embed java code into the js.
  • A jsp scriplet starts with "<%" and ends with "%>".
  • <% java code%>
  • To serve the client request what ever java code required that is placed in servlet.
  • In servlet programming whatever code we write in the service() method of user defined servlet all that code can be placed in a jsp scriplet.
  • During the translation phase java code placed in the scriplet is written in to _jspService() method of page implementation class.
  • in jsp we can have any number of scriplets.

Instance Of Java

We will help you in learning.Please leave your comments and suggestions in comment section. if you any doubts please use search box provided right side. Search there for answers thank you.
«
Next
Newer Post
»
Previous
Older Post

No comments

Leave a Reply

Select Menu