20030402 Wednesday April 02, 2003

String Tag Library 1.0.1 Jakarta's String Tag Library version 1.0.1 was released about a month ago. I found out today. I'm telling you here because you might be able to use it if you need to manipulate Strings for your UI. The only tag I'm using (from this library) <s:replace>, which can be very handy indeed. For instance, a common task with JSPs is the need to replace a new-line (\n) with an HTML new-line (<br />). With the String TL, it's easy (JSP 2.0 Syntax):

<s:replace replace="NL" with="&lt;br /&gt;NL" 
    newlineToken="NL">${myForm.text}</s:replace>

Posted in Java at Apr 02 2003, 03:36:36 PM MST 1 Comment

Comments:

I'd recommend using the textUtils class from OpenSymphony. It doesn't have a tag, but here is the content from the Text2Html tag that we use for JIRA: public int doEndTag() throws JspException { try { String body = bodyContent.getString(); bodyContent.clearBody(); bodyContent.getEnclosingWriter().write(TextUtils.plainTextToHtml(body)); } catch (IOException e) { throw new JspException("IOException: " + e); } return super.doEndTag(); }

Posted by Scott Farquhar on April 02, 2003 at 05:00 PM MST #

Post a Comment:
  • HTML Syntax: Allowed
Click me to subscribe
Matt Raible is the Lead UI Architect at LinkedIn. The opinions on this site are mine, not my employers.
« November 2008
SunMonTueWedThuFriSat
      
1
2
3
6
7
8
9
10
11
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
      
Today

Recent Entries

Tag Cloud