Question

While taking an OCWCD practice exam (Whizlabs), I ran across some syntax I haven't seen before (and can't seem to find a clear explanation of).

Question: Which of the following is valid in a JSP document?

Correct answer: <jsp:include page="%=pageName%"/>

The explanation states,

For a request time expression in XML syntax, we have to use %= %. Also note that the JSP syntax uses <%= %> syntax for request time expressions.

I'm clear on the JSP syntax, but I'm not familiar with %= %. Can anyone explain to me the %= % syntax used here? I'm lost.

Was it helpful?

Solution

The expressions: <%! %> declaration, <%= =%> scripting expression, scriptlet, and the others, are not valid as syntax in a XML document, so to make it compatible with JSP XML syntax we need to use the corresponding expression %= =, You should check this article JSP XML Support

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top