91-9990449935 0120-4256464 |
JSP Declaration TagThe JSP declaration tag is used to declare fields and methods. The code written inside the jsp declaration tag is placed outside the service() method of auto generated servlet. So it doesn't get memory at each request. Syntax of JSP declaration tagThe syntax of the declaration tag is as follows: Difference between JSP Scriptlet tag and Declaration tag
Example of JSP declaration tag that declares fieldIn 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.jspExample of JSP declaration tag that declares methodIn 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. index.jsp
Next TopicJsp Implicit Objects
|