JSP Action Tags
What is a JavaBean wrt to JSP?
A JavaBean is a Java class that should follow the following conventions 1. It should have a no-arg constructor. 2. It should be Serializable. 3. It should provide methods to set and get the values of the properties, known as getter and setter methods.
Why use JavaBean?
According to Java white paper, it is a reusable software component. A bean encapsulates many objects into one object so that we can access this object from multiple places. Moreover, it provides easy maintenance.
Advantage of jsp:include action tag
Code reusability : We can use a page many times such as including header and footer pages in all pages. So it saves a lot of time.
JSP Action Tag
It is a tag which is used to control the flow between pages and to use Java Bean.
jsp:forward action tag
The jsp:forward action tag is used to forward the request to another resource it may be jsp, html or another resource.
jsp:include action tag
The jsp:include action tag is used to include the content of another resource it may be jsp, html or servlet. The jsp include action tag includes the resource at request time so it is better for dynamic pages because there might be changes in future. The jsp:include tag can be used to include static as well as dynamic pages.
jsp:useBean
The jsp:useBean action tag is used to locate or instantiate a bean class. If bean object of the Bean class is already created, it doesn't create the bean depending on the scope. But if object of bean is not created, it instantiates the bean.
JSP Action Tags
There are 8 jsp action tags
Difference between jsp include directive and include action
check diagram
jsf:param
jsp:param is an action tag that sets value for a parameter. It is used in conjunction with jsp:forward and jsp:include action tags mostly.