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

How may a tag, that must not have a body, be written?

As an empty tag:
<...../>

As a tag with nothing between the opening and closing tags:
<x>   </x>

As a tag with only <jsp:attribute> tags between the opening and closing tags:
<x>
    <jsp:attribute name=”user”>${userName}</jsp:attribute>
   
(only exception, just to define attributes...!)
</x>

Fenster schliessen

How can the value of a HTML-chunk "myHTML" be printed out including
any contained HTML-tags, using a JSTL custom tag?

<c:out value='${pageContent.myHTML}' escapeXml='true' />
(true is the default and can therefore be omitted)

Fenster schliessen

How can a JSTL custom tag be used to display "Hello <user>",
but "Hello guest!"
in case the value of "user" is null?


Hello <c:out value=’${user}’ default=’guest />!

- or -

Hello <c:out value=’${user}’>guest</c:out>!

Fenster schliessen

How can a JSTL custom tag be used to iterate through a String[] array,
defined as a request attribute "myArray", and print out all elements
as a HTML table?

 <c:forEach var=”element” items=”${myArray} >
   <tr>
     
<td>${element}</td>
   </tr>
 </
c:forEach>

Fenster schliessen

How can a collection, set as request parameter, be iterated over using a
JSTL custom tag while displaying a counter for all elements?

 <c:forEach var=”x” items=”${myCollection}varStatus=”myLoopCount >
    Count is: ${myLoopCount.count}
 </c:forEach>

Fenster schliessen

What is the standard, conventional directive for using the JSTL?

<%@ taglib prefix=”c” uri=”http://java.sun.com/jsp/jstl/core %>

Fenster schliessen

How can a JSTL custom tag be used to include a file "thePage.jsp"
only if the attribute "userType" has the value "member"?

<c:if test=”${userType eq ‘member’ } >
    <
jsp:include page=”thePage.jsp/>
</
c:if>

Fenster schliessen

How can an if-else-condition be implemented using JSTL custom tags?

<c:choose>
  <
c:when test=”${userPref == "whatever"}>
       ...doAllKindsOsomeStuff
  </c:when>
  <
c:otherwise>
      ...doSomethingElse
  </c:otherwise>
</
c:choose>