Users' questions

What are the directives in JSP?

What are the directives in JSP?

Directives are elements that relay messages to the JSP container and affect how it compiles the JSP page. The directives themselves do not appear in the XML output. There are three directives: include, page, and taglib.

What are JSP actions?

JSP actions are special XML tags that control the behavior of the servlet engine. JSP actions allow you to insert a file dynamically, reuse external JavaBean components, forward the request to the other page and generate HTML for Java Applet Plugin.

How is include action different from JSP directive?

This jsp:include action is different from jsp directive. Include directive includes resources at the time of translation, whereas include action includes resources dynamically at request time. Action directives work well for static pages, whereas later works better for dynamic pages. Page: its value is the url of the required resource.

What is the purpose of an action in JSP?

This action is useful for passing the parameters to Other JSP action tags such as JSP include & JSP forward tag. This way new JSP pages can have access to those parameters using request object itself.

How are directives described in JSP life cycle phase?

In JSP life cycle phase, JSP has to be converted to a servlet which is the translation phase. They give instructions to the container on how to handle certain aspects of JSP processing Directives can have many attributes by comma separated as key-value pairs. In JSP, directive is described in <%@ %> tags. There are three types of directives:

How is the header file directive used in JSP?

So you will get the output as “Header file: 2” from _jsp3.jsp and “This is main file” from _jsp2.jsp. JSP taglib directive is used to define the tag library with “taglib” as the prefix, which we can use in JSP. It uses a set of custom tags, identifies the location of the library and provides means of identifying custom tags in JSP page.