Lernkarten

Karten 109 Karten
Lernende 1 Lernende
Sprache English
Stufe Andere
Erstellt / Aktualisiert 12.09.2017 / 13.11.2017
Lizenzierung Keine Angabe     (Fabrizi)
Weblink
Einbinden
0 Exakte Antworten 109 Text Antworten 0 Multiple Choice Antworten
Fenster schliessen

Whichs steps are necessary to redirect a request
from a specific page to an error page?

Original page, which may cause errors:
<%@ page errorPage=”errorPage.jsp %>

Error Page:
<%@ page isErrorPage=”true %>

Fenster schliessen

How can all thrown Throwables be set to get redirected to a specific error page
from inside the DD, while specific pages can still override this setting using a directive?

<error-page>
    <exception-type>java.lang.Throwable</exception-type>
    <location>
/errorPage.jsp</location>
</error-page>

Fenster schliessen

How can all response status codes "404" be set to get redirected to a specific error page 
from inside the DD, while specific pages can still override this setting using a directive?

<error-page>
    <error-code>404</error-code>
    <location>
/notFoundError.jsp</location>
</error-page>

Fenster schliessen

What makes the implicit JSP object "exception" available
and which is the according EL implicit object?

Only a page directive:
<%@ page isErrorPage=”true %>

EL:
${pageContext.exception}

Fenster schliessen

How can the exception caused by this scriptlet code:

 <% int x = 10/0; %>

be caught and the text "...caught the exception!" be displayed,
instead of redirecting to an error page?

<c:catch>
    <
% int x = 10/0%>
</
c:catch>
...caught the exception

Fenster schliessen

How can an exception be caught and displayed inside a JSP,
rather than redirecting to an error page?

<c:catch var=”myException>
   
...an exception is thrown...
</c:catch>

<c:if test=”${myException != null}>
    ${myException.message
<
/c:if>

Fenster schliessen

How can a .tld file with a specific location be mapped to an URI inside the DD?

(no longer required for JSP 2.0)

<jsp-config>
  <taglib>
    <taglib-uri>myURI</taglib-uri>
    <taglib-location>/WEB-INF/myFunctions.tld</taglib-location>
  </taglib>
</jsp-config>

Fenster schliessen

Where does the container look for .tld files?

WEB-INF
and sub-directories

WEB-INF/lib/<JAR-FILE> ---> META-INF
and sub-directories