Question 4) Sun Certified Web Component

Posted on
Like what you see? Share it.Share on Google+Share on LinkedInShare on FacebookShare on RedditTweet about this on TwitterEmail this to someone

Objective: The JavaServer Pages (JSP) Technology Model
SubObjective: * Identify, describe, or write the JSP code for the following elements: (a) template text, (b) scripting elements (comments, directives, declarations, scriptlets, and expressions), (c) standard and custom actions, and (d) expression language elements.
Multiple Answer Multiple Choice

 

Which three statements are true of Theinclude directive? (Choose three.)

 

 

  1. Theinclude directive is used to include only static content.
  2. The inclusion of a file occurs at the time of page compilation.
  3. The inclusion of a file occurs at the time of page execution.
  4. Theinclude directive has an attribute namedfile to specify the name of the file to be included.
  5. Theinclude directive has an attribute namedpage to specify the name of the file to be included.
  6. During compilation, the file content is not physically included, but a link to the file is established.

 

 

 

Answer:
A. Theinclude directive is used to include only static content.
B. The inclusion of a file occurs at the time of page compilation.
D .Theinclude directive has an attribute namedfile to specify the name of the file to be included.

Tutorial:
The include directive is used to include only static content, the inclusion of a file occurs at the time of page compilation, and the include directive has an attribute named file to specify the name of the file to be included. The include directive is used to include only static content. The JSP code included using the include directive will only be processed after the entire page is translated or compiled into a servlet. The inclusion of a file with the include directive occurs at the time of page compilation. In contrast, when the <jsp:include> directive is used, the file is included when the JSP is executed, allowing for the request to be sent to the included resource. Both the page and <jsp:include> resources are executed and their results are combined for the response.

 

The include directive has an attribute named file to specify the name of the file to be included. The include directive has the following syntax:
<%@ include file=”filename”% >

 

In this syntax, filename is the name of the file that should be included. This file can be a JSP, an HTML, or a text file.

 

With the include directive, the file is included when the JSP is compiled into a servlet. Instead, when the <jsp:include> directive is used, the file is included when the JSP is executed, allowing for the request to be sent to the included resource. Both the page and <jsp:include> resources are executed and their results are combined for the response.

 

The include directive does not have an attribute named page to specify the name of the file to be included. The include directive has thefile attribute to specify the name of the file to be included. The file content is physically included, and no link to the file is established during compilation. With the include directive, the inclusion of a file occurs at the time of page compilation.

 

Reference:
1. JavaServer Pages (JSP) v2.0 Syntax Reference, Include Directive, http://java.sun.com/products/jsp/syntax/2.0/syntaxref209.html#1003408
2. SCWCD 1.4 Study Guide, Chapter 6: The JavaServer Pages (JSP) Technology Model, Given a specific design goal for including a JSP segment in another page, write the JSP code that uses the most appropriate inclusion mechanism, The include directive, http://java.boot.by/wcd-guide/ch06s07.html

 

These questions are derived from the Self-Test Software Practice Test for 310-081 – Sun Certified Web Component Developer for J2EE Platform 1.4 .

Like what you see? Share it.Share on Google+Share on LinkedInShare on FacebookShare on RedditTweet about this on TwitterEmail this to someone
cmadmin

ABOUT THE AUTHOR

Posted in Archive|

Comment: