Difference between JSP Scriptlet tag and Declaration tag
Jsp Scriptlet Tag- The jsp scriptlet tag can only declare variables not methods.
- The declaration of scriptlet tag is placed inside the _jspService() method.
Jsp Declaration Tag
In this example of JSP declaration tag, we are declaring the field and printing the value of the declared field using the jsp expression tag.
index.jsp
<html>
<body>
<%! int data=50; %>
<%= "Value of the variable is:"+data %>
</body>
</html>
Example of JSP declaration tag that declares method
In this example of JSP declaration tag, we are defining the method which returns the cube of given number and calling this method from the jsp expression tag. But we can also use jsp scriptlet tag to call the declared method.
- The jsp declaration tag can declare variables as well as methods.
- The declaration of jsp declaration tag is placed outside the _jspService() method.
In this example of JSP declaration tag, we are declaring the field and printing the value of the declared field using the jsp expression tag.
index.jsp
<html>
<body>
<%! int data=50; %>
<%= "Value of the variable is:"+data %>
</body>
</html>
Example of JSP declaration tag that declares method
In this example of JSP declaration tag, we are defining the method which returns the cube of given number and calling this method from the jsp expression tag. But we can also use jsp scriptlet tag to call the declared method.
Thanks for this wonderful blog, keep sharing your thoughts like this...
ReplyDeleteHow Does Linux Work
Information About Linux Operating System
>>>>> Download Now
ReplyDelete>>>>> Download Full
>>>>> Download LINK
>>>>> Download Now
>>>>> Download Full
>>>>> Download LINK