7.What are the types of scripting elements?
There are three types of scripting elements:
- Scriptlets
- Declaration
- Expression
8. How to create a scriptlet?
Scriptlets are embedded between <% and %> delimiters.
Syntax: <% java code goes in here %>
9. What is declaration element?
- Declarations are used to declare, define methods and instance variables.
- Declaration tags does not produce any output that is sent to client.
- The methods and classes declared will be translated as class level variables and methods during translation.
10. How to declare methods or variables in JSP?
Methods or variables are declared using <%! and %> delimiters.
Syntax: <%! variable=0; %>
11. What is expression element?
Expression element are used to write dynamic content back to the client browser. It is used in place of out.print() method. Only expressions are supported inside the tag. Declarations of methods and variables is not possible inside this tag.
12. What happens to expression element during translation?
During translation the return type of expression goes as argument into out.print() method.
13. How to use expression element?
Expressions are embedded in <%= and %> delimiters.
Syntax: <% expression 1 %>
14. What are the two types of comments supported by JSP.
There are two types of comments supported by JSP:
HTML comment - <!—This is a comment -->JSP comment - <%-- This is a comment --%>
15. What is the difference between HTML and JSP comments?
HTML comments are passed during the translation phase and hence can be viewed in the page source in the browser. JSP comments are converted to normal java comments during the translation process and will not appear in the output page source.
No comments:
Post a Comment