JSP Actions : Java Glossary

JSP actions are XML tags that forces the server to directly use the server to the existing components or control the behavior of the JSP engine.

JSP Actions : Java Glossary

JSP Actions : Java Glossary

     

JSP actions are XML tags that forces the server to directly use the server to the existing components or control the behavior of the JSP engine. JSP Actions are made of a usually (XML-based) prefix of "jsp" followed by a colon, followed by the action name followed by one or more attribute parameters.

Many action tags are available for Java Server Pages. but most commonly used action tags are three of them and they are namely:

  • <jsp: include />
  • <jsp: forward/>
  • <jsp: useBean/>

jsp include action (<jsp: include />): include is a similar to jsp include directive tag but with a slight difference. The include tag includes either a static or a dynamic content, as and when required.

jsp forward action (<jsp: forward/>): jsp forward action transfers the control to a static or dynamic resource. The static or dynamic resource to which control is transferred is represented as a URL. The user can forward the control to an HTML file, another JSP file, or a servlet. It should be noted that the target file must be in the same application context as the forwarding JSP file.

jsp useBean action (<jsp: useBean/>): This action tag is the most commonly used tag as it has powerful features. By using this action a JSP creates an instance or receive an instance of a Java Bean. It creates or instantiates a bean having specific name and scope. It first locates the instance of the bean, and if the bean is not present, then the <jsp: useBean /> instantiates by using a class.