java - Limit string length in FreeMarker -
I am trying to get a substrings from string in FreeMarker. Although there are 2 lemons to consider:
- The string may be blank
- The string may be less, the length of the maximum string
I do the following:
& lt; #list Landing Page 1.popular; As a line & gt; & Lt; Li & gt; & Lt; Span class = "minititle" & gt; & Lt; #assign minititle = (row.title! "") & Gt; & Lt; #if Minute Length & amp; Lt; 27 & gt; $ {Minutes} & lt; # Else & gt; $ {Minititle? Substring (0,26)} ... and lieutenant; # / If & gt; & Lt; / Span & gt; & Lt; / Li & gt; & Lt; / # List & gt;
I get a freemarker error:
Failed to load template: Expected " ; Line 65 on Line 144, Landing Page 1. One in the Fort was expected: & gt; ATTEMPT & gt; ... & lt; IF & gt; ... & lt; LIST & gt; ... & lt; FOREACH & gt; ... & lt; SWITCH & gt; ... & lt; ASSIGN & gt; ... & lt; Glomacine & gt; ... & lt; LOCALASSIGN & gt; ... & lt; Include & gt; ... & lt; Import & gt; ... & lt; Function & gt; ... & lt; Macro & gt; ... & lt; Transforms & gt; ... & lt; Visit & gt; ... & lt; STOP & gt; ... & lt; Returns & gt; ... & lt; Call & gt; ... & lt; Settings & gt; ... & lt; COMPRESS & gt; ... & lt; COMMENT & gt; ... & lt; TERSE_COMMENT & gt; ... & lt; NOPARSE & gt; ... & lt; END_IF & gt; ... & lt; BREAK & gt; ... & lt; SIMPLE_RETURN & gt; ... & lt; HALT & gt; ... & lt; FLUSH & gt; ... & lt; TRIM & gt; ... & lt; LTRIM & gt; ... & lt; RTRIM & gt; ... & lt; NOTRIM & gt; ... & lt; SIMPLE_NESTED & gt; ... & lt; Nested & gt; ... & lt; SIMPLE_RECURSE & gt; ... & lt; RECURSE & gt; ... & lt; Fallback & gt; ... & lt; Escape & gt; ... & lt; NOESCAPE & gt; ... & lt; UNIFIED_CALL & gt; ... & lt; WHITESPACE & gt; ... & lt; PRINTABLE_CHARS & gt; ... & lt; FALSE_ALERT & gt; ... "$ {" ... "# {" ... ...
Very strange. Can anyone help?
After extensive testing, the error itself was resolved. Karma should be done.
My last code for secure detection:
& lt; #assign minititle = (row.title! "") & Gt; & Lt; #if Minute Length & amp; Lt; 27 & gt; $ {Minutes} & lt; # Else & gt; $ {Min? Substring (0, 26)} ... ... & lt; / # If & gt;
Hope this helps someone else
Comments
Post a Comment