您的位置:首页 > 其它

reverse 函数,countVowels 函数,EL函数的使用

2007-11-09 10:25 316 查看
reverse 函数:将传入的字符串以反向顺序输出。

countVowels 函数:计算传入的字符串中,和aeiouAEIOU 吻合的字符个数。

EL函数的使用:

  Tomcat 的EL 函数范例,主要分为四个 分 (见表6-9):

表6-9
web.xml 设定taglib 的TLD 文件位置
functions.jsp 使用EL 函数的范例程序
jsp2-example-taglib.tld EL 函数、标签库的设定文件
jsp2.examples.el.Functions.java EL 函数主要程序逻辑处理 分

functions.jsp

<%@ taglib prefix="my"
uri="http://jakarta.apache.org/tomcat/jsp2-example-taglib"%>

<html>

<head>

<title>JSP 2.0 Expression Language - Functions</title>

</head>

<body>

<h1>JSP 2.0 Expression Language - Functions</h1>

…. 略

<blockquote>

<u><b>Change Parameter</b></u>

<form action="functions.jsp" method="GET">

foo = <input type="text" name="foo" value="${param['foo']}">

<input type="submit">

</form>

<br>

<code>

<table border="1">

<thead>

<td><b>EL Expression</b></td>

<td><b>Result</b></td>

</thead>

<tr>

<td>/${param["foo"]}</td>

<td>${param["foo"]} </td>

</tr>

<tr>

<td>/${my:reverse(param["foo"])}</td>

<td>${my:reverse(param["foo"])} </td>

</tr>

<tr>

<td>/${my:reverse(my:reverse(param["foo"]))}</td>

<td>${my:reverse(my:reverse(param["foo"]))} </td>

</tr>

<tr>

<td>/${my:countVowels(param["foo"])}</td>

<td>${my:countVowels(param["foo"])} </td>

</tr>

</table>

</code>

</blockquote>

</body>

</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐