JSP Elements & Directives Flashcards

1
Q

scriptlet

A
  • scriptlet tag allows to write Java code into JSP
  • it can contain any number of Java statements, variable or method declarations, or expressions that are valid in the page scripting language
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

JSP declaration tag

A

< %! Inside this tag we can initialize our variables, methods, and classes % >

open angled bracket percent exclamation mart + codes + percent closed angled bracket

  • it is for declaring variables, methods and classes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

syntax of Scriptlet tag

A

< % java code % >

- it allows to write/insert Java code into JSP file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

syntax of JSP expression

A

< %= expression % >

  • it evaluates the expression placed in it
  • it allows creating expressions like arithmetic and logical
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

syntax of JSP comments

A

< % – JSP comments – % >

- is used to comment in JSP and ignored by the JSP container

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the 3 scripting elements in JSP?

A
  • scripting tag
  • expression tag
  • declaration tag
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

JSP Directives

A

< %@ directive attribute=”value” % >

  • directions and instructions to the container, telling it how to handle certain aspects of the JSP processing
  • a JSP directive affects the overall structure of the servlet class
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

3 types of JSP directives

A
  • Page directive
  • Include directive
  • Taglib directive
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Page directive

A

< % @page .. % >

  • it provides attributes that get applied to the entire JSP page
  • by convention, it is coded at the top of the JSP page
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

import attribute

A
  • the most used attribute in page directive

- similar to the import statement, it tells the container to import other java classes, interfaces, enums, etc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Include directive

A

< % include file = “filename” % >

  • it is used to include a file during the translation phase
  • it tells the container to merge the content of other external files with the current JSP
  • you may code the include directives anywhere on your JSP page
  • very useful in creating templates with the user views and breaking the pages into header & footer and sidebar actions
How well did you know this?
1
Not at all
2
3
4
5
Perfectly