2. <jsp irective.page contentType="text/html" />
5. for(int i=0; i<5; i++)
Which of the following statements are correct?
Select 1 correct option.
a This will generate output without any errors.
b Line 3 must be enclosed in <jsp:text> and </jsp:text>.
c Although line 3 is valid but "Hello" will not be displayed as HEADER1 format in the browser.
d Line 5 is invalid.
e Line 10 is invalid.
I thought ans is A but
Anwer is D
It should be written as:
for(int i=0; i<5; i++)
I also make reference to it with operators such as <= in EL (use "le" instead). Without giving too much away, there's also a couple of test questions along these lines.
The body content in each of these elements should be valid Java code, as would appear in the JSP scripting elements, except to ensure the document is well-formed XML you should use a CDATA section or replace & and < characters with the entity references & and < respectively.
[ July 22, 2006: Message edited by: Charles Lyons ]
* For a JSP page, the <jsp:text> is required for this example to work correctly; having the CDATA alone will just cause the CDATA to be output to be the client. However, this would all be unnecessary for a page, because a page doesn't need to be well-formed anyway.
[ July 23, 2006: Message edited by: Charles Lyons ]