Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
- <% pageContext.setAttribute("newLineChar", "n"); %>
- ${fn:replace(item.comments, newLineChar, "; ")}
- <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
- <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
- <c:set var="newline" value="n"/>
- ${fn:replace(data, newLine, "; ")}
- <?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>
- <short-name>sf</short-name>
- <uri>http://www.stackoverflow.com</uri>
- <function>
- <name>clean</name>
- <function-class>com.stackoverflow.web.tag.function.TagUtils</function-class>
- <function-signature>
- java.lang.String clean(java.lang.String)
- </function-signature>
- </function>
- </taglib>
- package com.stackoverflow.web.tag.function;
- import javax.servlet.jsp.tagext.TagSupport;
- public class TagUtils extends TagSupport {
- public static String clean(String comment) {
- return comment.replaceAll("n", "; ");
- }
- }
- <%@ taglib prefix="sf" uri="http://www.stackoverflow.com"%>
- ${sf:clean(item.comments)}
- ${fn:replace(data, '\n', ';')}
- ${fn:replace(data, '\n', ';')}
- ${fn:replace(data, '\n', ';')}
- <%@ taglib prefix="str" uri="http://jakarta.apache.org/taglibs/string-1.1" %>
- ...
- <str:replace var="result" replace="~n" with=";" newlineToken="~n">
- Text containing newlines
- </str:replace>
- ...
- <%@ taglib prefix="ns" uri="..." %>
- ...
- ${ns:replace(data)}
- <c:set var="newline" value="n"/>
- ${fn:replace(data, newLine, "; ")}
- <% pageContext.setAttribute("newLineChar", "n"); %>
- ${fn:replace(item.comments, newLineChar, "; ")}
- <% pageContext.setAttribute("newLineChar", "r"); %>
- <c:set var="textAreaDefault" value="${fn:replace(textAreaDefault, newLineChar, '')}" />
- <str:replace var="your_Var_replaced" replace="n" with="Your ney caracter" newlineToken="n">${your_Var_to_replaced}</str:replace>
- ${fn:replace(text, "
- ", "<br/>")}
- <c:set var="nl" value="
- " /><%-- this is a new line --%>
- <c:set var="newline" value="<%= "n" %>" />
- ${fn:replace(myAddress, newline, "<br />")}
- <c:set var="newline" value="
- " /><!--this line can't be indented -->
- ${fn:replace(myAddress, newline, "<br />")}
Add Comment
Please, Sign In to add comment