标签:style blog http io ar os 使用 sp java
package com.util;
public class StringDeal {
public static String shiftEnter(String string){
String newString = string.replace("\r\n", "<br>");
newString = newString.replace(" ", " ");
return newString;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<taglib version="2.0" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-jsptaglibrary_2_0.xsd">
<tlib-version>1.0</tlib-version>
<uri>/stringDeal</uri>
<function>
<!-- 调用的函数名称-->
<name>shiftEnter</name>
<!-- 调用的类java-->
<function-class>com.util.StringDeal</function-class>
<!-- 调用的函数的参数类型,和函数返回值类型-->
<function-signature>java.lang.String shiftEnter(java.lang.String)</function-signature>
</function>
</taglib>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!-- 注意下面这行,的uri使用的是tld中的url,而perfix是对象 -->
<%@ taglib uri="/stringDeal" prefix="sd"%>
<meta charset="utf-8">
<html>
<body>
<%request.setCharacterEncoding("utf-8"); %>
<!-- EL表达是中的函数使用,StringDeal中的shiftEnter函数 -->
${sd:shiftEnter(param.content) }
</body>
</html>
标签:style blog http io ar os 使用 sp java
原文地址:http://www.cnblogs.com/sober-reflection/p/4095499.html