<%@ taglib PRefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>1.<sql:setDataSource>设置数据源
<sql:setDataSource url="jdbc:MySQL://localhost:3306/xxx"driver="com.mysql.jdbc.Driver"user=""passWord=""/>var设置变量名称,scope设置范围,默认page,没有var,就是scope默认的数据源。2.<sql:query>
sql:select语句dataSource:数据源,没有就默认。maxRows:从原始查询结果中取出的最大数目startRow:从哪行开始读结果记录,索引从0开始var,scope返回结果为Result类型,有几个方法String[] getColumnNames():返回所有字段名字int getRowCount:返回所有记录数目SortedMap[] getRows():返回行Object[][] getRowsByIndex():一维表示行一维表示列boolean isLimitedByMaxRows()原始结果小于等于maxRows返回false.3.<sql:param>用来设置sql语句中?的值。可以嵌套在sql:query和sql:update中。4.<sql:dataParam>跟上面一样是设置值的,只不过是设置的时间值value:date类型
type:date,time,timestamp(默认)
5.<sql:update>
sql:update,insert,delete等语句。dataSource:数据源var::受影响记录数。scope:范围6:.<sql:transaction>事务,可以包含多个query和updatedataSource:数据源,这里面的query和update不用设置数据源了。
isolation:隔离级别。
1.serializable:串行化。
2.repeatable_read:可重复读
3.read_committed:读已提交数据
4.read_uncommitted:读未提交数据
隔离级别由高到底,并发性能由低到高,一般设置read_committed就行。
<%@ taglib prefic="fn" uri="http://java.sun.com/jsp/jstl/functions"%>1.fn:contains(String source,String target)判断是否包含字符串${fn:contains("Tomcat","cat")}//true${fn:contains("Tomcat","CAT")}//false2.fn:containsIgnoreCase(String source,String target)判断是否包含字符串,忽略大小写3::fn:startsWith(String source,String target)判断是否以某个字符串开头。
4::fn:endsWith(String source,String target)判断是否以某个字符串结尾。
5::fn:indexof(String source,String target)返回包含字符串第一字符的索引。没有就返回-1
6::fn:replace(String source,String before,String after)把source中的before替换成after
7.fn:substring(String source,int beginIndex,int endIndex)endIndex为最后一个字符所在位置加1
fn:substring("Tomcat",0,4)//Tom8.fn:substringBefore(String source,String target)返回target在source之前的字符串,没有就返回空字符串9.fn:substringAfter(String source,String target)返回source中在target之后的字符串,没有就返回空字符串
10.fn:split(String source,String delimiter)分割字符串,参数为null或者没有分割字符串的字符,就返回原字符串。
11.fn:join(String[] source,String separator)合并字符串,中间用separator连接。
12.fn:toLowerCase(String source)转为小写。
13.fn:toUpperCase(String source)转为大写。
14.fn:trim(String source)去掉首尾空格
15.fn:escapexml(String source)特殊字符转译“<>”等等
16.fn:length(source)返回字符串,集合数组的长度。
新闻热点
疑难解答