First, let's talk about how OGNL calls.
<s:setname= "albumimg" value= "@com. ISS.PORTAL.BASE.UTIL.FILETOOLS@GETIMGBYWH (#oneAlbum. Cover, ' 100x100 ')" > </s:set>
Secondly
El expressions invoke Custom functions
The function in the 1 El expression call JavaBean is very simple, as long as there is a getxxx method, you can write ${javaben.xxx on the page to invoke the method
2 El expression calls the method in the label <tag>:
as in El Call Jstl, the <fn:contains/> method is as follows: \
<%@ taglib prefix= "FN" uri= "http://java.sun.com/jsp/jstl/functions"%> ${fn:contains
(STRINGA,STRINGB)}
Additionally El calls the custom label method as follows:
1. Create a mytag.tld file under the Webroot\web-inf directory.
2.mytag.tld content is
<?xml version= "1.0" encoding= "UTF-8"?> <taglib "xmlns=" Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation= "Http://java.sun.com/xml/ns/j2ee http:/ /java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd "version=" 2.0 "> <tlib-version>1.0</tlib-versio N> <short-name>el</short-name> <function> <!--description of this El method--> <description
>calculate string length</description> <name>FunctionsEl</name><!--Call the name of the El method-->
<function-class>com.el.code.FunctionsEl</function-class> <function-signature> Java.lang.String Elencode (java.lang.String) </function-signature> <example>${el:funct Ionsel (str)}</example><!--For example--> </function> </taglib>
3. Under the Com.el.code package, create a new class named Functionsel.
Package com.gouwu.youboy.util;
Import java.io.UnsupportedEncodingException;
Import Java.net.URLEncoder;
/**
* @project XXX *
@author: XXX
* @version 1.0
* @Create: 5:41:27 PM
* @Update:
* @describe : * * Public
class Functionsel {
/**
* transcoding in Chinese
* @param str Chinese string
* @return A string after Chinese encoding
*
/public static string Elencode (String str) {
string decodestr = null;
try {
decodestr = Urlencoder.encode (str, "UTF-8");
} catch (Unsupportedencodingexception e) {
E.printstacktrace ();
}
Return Decodestr
}
}
4. Refer to the JSP page as follows:
<%@ taglib prefix= "el" uri= "/web-inf/mytag.tld"%>
${el:functionsel (iklist)}