Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
26 views

Tutorial Week 6

The document discusses a lecture assignment involving JSP concepts. Students are asked to answer questions that test their understanding of key JSP topics from lecture notes and videos, including: 1) The file extension and processing of JSP pages 2) Where JSP files should be placed to run from a web server 3) The difference between displaying an HTML file versus JSP file in a browser 4) The differences between Servlets and JSPs 5) JSP expression, scriptlet, and declaration tags and how to write them 6) Identifying syntax errors in sample JSP code 7) Determining which variables are instance versus local in translated JSP servlet
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

Tutorial Week 6

The document discusses a lecture assignment involving JSP concepts. Students are asked to answer questions that test their understanding of key JSP topics from lecture notes and videos, including: 1) The file extension and processing of JSP pages 2) Where JSP files should be placed to run from a web server 3) The difference between displaying an HTML file versus JSP file in a browser 4) The differences between Servlets and JSPs 5) JSP expression, scriptlet, and declaration tags and how to write them 6) Identifying syntax errors in sample JSP code 7) Determining which variables are instance versus local in translated JSP servlet
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 4

Lecture Assignment

Tutorial Week 6
Our readings (lecture notes and video lecture) this week discuss the JSP (Basic JSP, MVC JSP,
JSP Construct). 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. What is the file name extension of a JavaServer page? How is a JSP .JSP
page processed?
2. Where should a JSP file be placed for it to run from Web Server Put it in the html
(Glassfish Server)? file or in the root or
in a subdirectory
below the web
application
3. You can display an HTML file (e.g., c:\test.html) by typing the complete JSP file must be
file name in the Address field of web browser. Why can’t you display a compiled into
JSP file by simply typing the file name? servlets

4. Explain the difference between Servlet and JSP. Servlet is a


controller and jsp
is a view

JSP is a HTML
based code while
servlet is java
based code
5. What are a JSP expression, a JSP scriptlet, and a JSP declaration? JSP expression
How do you write these constructs in JSP? - Used to
insert java
expression
directly into
the output
by using
the <
%=Java-
expression

MMR2022@FSKM
Lecture Assignment

%>
JSP scriplet
-JSP scriplet
enable us to insert
a JAVA statement
into the server
jspService
method, which is
invoke by the
service method by
using th following
form <%java
statement%>

JSP declaration
- Are used
to define
methods
and
instance
using the <
%and%>
delimeters
6. Find THREE syntax errors in the following code: The following code
<%! int k %> missing the “;”
<% for (int j=1; j < =9; j ++) { %>
< %=j; %> <br/> The second code
is incomplete

There is a space
gap between the
“<%”
There should be
opening tag

MMR2022@FSKM
Lecture Assignment

for<br></br>
7. In the following JSP, which variables are instance variables, and which B is instance
are local variables when it is translated into the servlet? variables by using
scriplet while
A is a local
variable by using
declaration

MMR2022@FSKM
Lecture Assignment

8. Write a JSP to display a table that contains factorials for the numbers
from 0 to 10, as shown in below.

MMR2022@FSKM

You might also like