0% found this document useful (0 votes)
36 views

Tutorial Week 7

The document is a lecture assignment that provides questions about JSP directives, JSTL tags, and variables. It asks students to answer 5 questions in their own words about JSP directives and attributes, importing classes, placing custom classes, instance and local variables in JSP, and using predefined variables in declarations. The questions test understanding of key concepts in JSP like directives, imports, variable scope, and using built-in objects.
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views

Tutorial Week 7

The document is a lecture assignment that provides questions about JSP directives, JSTL tags, and variables. It asks students to answer 5 questions in their own words about JSP directives and attributes, importing classes, placing custom classes, instance and local variables in JSP, and using predefined variables in declarations. The questions test understanding of key concepts in JSP like directives, imports, variable scope, and using built-in objects.
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

Lecture Assignment

Tutorial Week 7
Our readings (lecture notes and video lecture) this week discuss the JSP (JSP Directives and
JSTL tags). Write the answers for all questions in the table according to your understanding.
PLEASE USE YOUR OWN WORDS. DO NOT COPY FROM THE WEB.

Questions Answers
1. Describe the JSP directives and attributes for the page JSP directive is used to provide instruction to
directive. the container that pertain the current JSP
page. There are 13 attributes.
2. If a class does not have a package statement, can you The class cannot be imported because it is
import it? mandatory to have a package statement

3. If you use a custom class from a JSP, where should the Lib directory
class be placed?
4. In the following JSP, which variables are instance I is an instance variables
variables, and which are local variables when it is while
translated in the servlet? j and k are local variables

5. What is wrong with below code? Declaration is used for the method or field
Should be using scriplet

6. Can you use predefined variables (e.g., request, No


response, out) in JSP declarations? Write an example <%@page
code for request and response. contentType="text/html"pageEncoding="UTF-
8"%> <!DOCTYPE html> <html> <head>
<title>Hello World</title> </head> <body> <
%-- This is a JSP Comment before JSP
Scriplet --%> <%!public static int factorial(int
num){ if(num==0) {return 1;} else{return num

MMR2020@FSKM
Lecture Assignment

* factorial(num-1);} }%> <% for(int i =1;i<11;i+


+){out.println("Factorial of " + i +" is "+
factorial(i)+"<br>");}%> </body> </html>

MMR2020@FSKM

You might also like