KEMBAR78
Nwenyi Geneviev Java | PDF
0% found this document useful (0 votes)
10 views2 pages

Nwenyi Geneviev Java

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views2 pages

Nwenyi Geneviev Java

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

NWENYI GENEVIEVE . C.

(FCAI/CSC/ND/2022/627)
1.Examples of page directive attributes in Java Servlet:

i.import: Specifies the classes or packages to be imported.

ii.contentType: Specifies the MIME type of the response.

iii.session: Specifies whether the JSP page participates in session tracking.

iv.buffer: Specifies the size of the buffer used for output.

V. isErrorPage: Specifies whether the JSP page is an error page.

2).Examples of taglib directive in Java Servlet:

i.<%@ taglib uri="http://example.com/mytags" prefix="mytags" %>: This directive imports a custom tag
library with the specified URI and assigns it the prefix "mytags".

ii.<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>: This directive imports the JSTL core
tag library with the prefix "c".

3).Examples of JSP action elements in Java Servlet:

i.<jsp:include page="header.jsp" />: Includes the content of the specified JSP page at the current
location.

ii.<jsp:forward page="error.jsp" />: Forwards the request to the specified JSP page.

iii.<jsp:useBean id="user" class="com.example.User" />: Instantiates a JavaBean with the specified ID


and class.

4).Explanation of control flow statements:

i.Decision making statement: These statements allow you to make decisions based on certain
conditions. Examples include if, else if, and switch statements.

ii.Loops: Loops allow you to repeat a block of code multiple times. Examples include for, while, and do-
while loops.
5). JSP operators and examples:

i.Arithmetic operators: +, -, *, /, %. Example: <%= 5 + 3 %> outputs 8.

ii.Relational operators: ==, !=, <, >, <=, >=. Example: <%= 5 > 3 %> outputs true.

iii.Logical operators: &&, ||, !. Example: <%= (5 > 3) && (2 < 4) %> outputs true.

6).JSP literals:

i.String literals: Enclosed in double quotes. Example: "Hello, World!".

ii.Numeric literals: Integer or floating-point numbers. Example: 42, 3.14.

iii.Character literals: Enclosed in single quotes. Example: 'A'.

iv.Boolean literals: true or false.

You might also like