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


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.

Updated on: 30-Jul-2019

302 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements