What do the id and scope attribute mean in the action elements in JSP?

JSPJava 8Object Oriented ProgrammingProgramming

These are two attributes that are common to all Action elements: the id attribute and the scope attribute.

Id attribute

The id attribute uniquely identifies the Action element and allows the action to be referenced inside the JSP page. If the Action creates an instance of an object, the id value can be used to reference it through the implicit object PageContext.

Scope attribute

This attribute identifies the lifecycle of the Action element. The id attribute and the scope attribute are directly related, as the scope attribute determines the lifespan of the object associated with the id. The scope attribute has four possible values:

  • (a) page, 
  • (b)request, 
  • (c)session, and 
  • (d) application.
Published on 20-Mar-2019 05:53:37