fn.jsp 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
  2. <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
  3. <%@ include file="../../upper.jsp" %>
  4. <h2> JSTL Functions Test </h2>
  5. <c:set var="s1" value="This is a JSTL Function Test"/>
  6. <table width='750' border='0' align='left' cellpadding='5'>
  7. <tr bgcolor="#bdb76b" height="40">
  8. <td><b><center>functions</center></b></td>
  9. <td><b><center>Input Strings</center></b></td>
  10. <td colspan=2><center><b>Arguments</center></b></td>
  11. <td><center><b>Results</b></center></td>
  12. </tr>
  13. <tr bgcolor="white">
  14. <td><b>length</b></td>
  15. <td>${s1}</td>
  16. <td colspan=2></td>
  17. <td>${fn:length(s1)}</td>
  18. </tr>
  19. <tr bgcolor="f5f5dc">
  20. <td><b>toLowerCase</b></td>
  21. <td>${s1}</td>
  22. <td colspan=2></td>
  23. <td>${fn:toLowerCase(s1)}</td>
  24. </tr>
  25. <tr bgcolor="white">
  26. <td><b>toUpperCase</b></td>
  27. <td>${s1}</td>
  28. <td colspan=2></td>
  29. <td>${fn:toUpperCase(s1)}</td>
  30. </tr>
  31. <tr bgcolor="f5f5dc">
  32. <td><b>substring</b></td>
  33. <td>${s1}</td>
  34. <td>11</td>
  35. <td>17</td>
  36. <td>${fn:substring(s1, 11, 17)}</td>
  37. </tr>
  38. <tr bgcolor="white">
  39. <td rowspan=2><b>substringAfter</b></td>
  40. <td>${s1}</td>
  41. <td colspan=2>This</td>
  42. <td>${fn:substringAfter(s1, "This")}</td>
  43. </tr>
  44. <tr bgcolor="white">
  45. <td>${s1}</td>
  46. <td colspan=2>empty string</td>
  47. <td>${fn:substringAfter(s1, "")}</td>
  48. </tr>
  49. <tr bgcolor="f5f5dc">
  50. <td><b>substringBefore</b></td>
  51. <td>${s1}</td>
  52. <td colspan=2>JSTL</td>
  53. <td>${fn:substringBefore(s1, "JSTL")}</td>
  54. </tr>
  55. <tr bgcolor="white">
  56. <td><b>replace</b></td>
  57. <td>${s1}</td>
  58. <td>s</td>
  59. <td>*</td>
  60. <td>${fn:replace(s1, "s", "*")}</td>
  61. </tr>
  62. <tr bgcolor="f5f5dc">
  63. <td rowspan=2><b>contains</b></td>
  64. <td>${s1}</td>
  65. <td colspan=2>JSTL</td>
  66. <td>${fn:contains(s1, "JSTL")}</td>
  67. </tr>
  68. <tr bgcolor="f5f5dc">
  69. <td>${s1}</td>
  70. <td colspan=2>jstl</td>
  71. <td>${fn:contains(s1, "jstl")}</td>
  72. </tr>
  73. <tr bgcolor="white">
  74. <td rowspan=2><b>containsIgnoreCase</b></td>
  75. <td>${s1}</td>
  76. <td colspan=2>JSTL</td>
  77. <td>${fn:containsIgnoreCase(s1, "JSTL")}</td>
  78. </tr>
  79. <tr bgcolor="white">
  80. <td>${s1}</td>
  81. <td colspan=2>jstl</td>
  82. <td>${fn:containsIgnoreCase(s1, "jstl")}</td>
  83. </tr>
  84. <tr bgcolor="f5f5dc">
  85. <td rowspan=2><b>startsWith</b></td>
  86. <td>${s1}</td>
  87. <td colspan=2>This is</td>
  88. <td>${fn:startsWith(s1, "This is")}</td>
  89. </tr>
  90. <tr bgcolor="f5f5dc">
  91. <td>${s1}</td>
  92. <td colspan=2>JSTL</td>
  93. <td>${fn:startsWith(s1, "JSTL")}</td>
  94. </tr>
  95. <tr bgcolor="white">
  96. <td rowspan=2><b>endsWith</b></td>
  97. <td>${s1}</td>
  98. <td colspan=2>JSTL</td>
  99. <td>${fn:endsWith(s1, "JSTL")}</td>
  100. </tr>
  101. <tr bgcolor="white">
  102. <td>${s1}</td>
  103. <td colspan=2>Test</td>
  104. <td>${fn:endsWith(s1, "Test")}</td>
  105. </tr>
  106. <tr bgcolor="f5f5dc">
  107. <td rowspan=2><b>indexOf</b></td>
  108. <td>${s1}</td>
  109. <td colspan=2>JSTL</td>
  110. <td>${fn:indexOf(s1, "JSTL")}</td>
  111. </tr>
  112. <tr bgcolor="f5f5dc">
  113. <td>${s1}</td>
  114. <td colspan=2>Test</td>
  115. <td>${fn:indexOf(s1, "Test")}</td>
  116. </tr>
  117. </table>
  118. <%@ include file="../../footer.html" %>