JSTL: 2 questions: no string concenating? no escaping characters?
Axel Janssen
Ranch Hand
Joined: Jan 08, 2001
Posts: 2164
posted
0
Hi, first a 3x thank you for Shawn Bayern: 1. JSTL is very clear and easy to use 2. Your book is very clear and easy to use (I think even for pure dhtml-designers) 3. JSTL really speeds me up I have 2 questions: 1. There is no String concenating in JSTL? When I try something like: <c ut value="${entry.cat_name + 'something completly different, but a String'}"/> it seems to expect double values for doing adition of numbers. 2. Is it possible to escape " or '? When I tried to dynamize some javaScript calls to build one of those fancy dhtml-navigators, it didn't work first, when I tried something similar to this: <c ut value="${'addParent(\"a name\")'}"/> I managed those problems by concenating the Strings I need for the javaScript in the Bean and using the very important escapeXml="false" parameter. Just for curiosity, if anybody knows: - am I missing something? - migth String concenating and escaping of characters be introduced in further releases or is it banned as quick-hack which confuses the page designers? regards Axel [ November 08, 2002: Message edited by: Axel Janssen ] [ November 08, 2002: Message edited by: Axel Janssen ]
Shawn Bayern
Author
Ranch Hand
Joined: May 06, 2002
Posts: 160
posted
0
Originally posted by Axel Janssen: Hi, first a 3x thank you for Shawn Bayern: 1. JSTL is very clear and easy to use 2. Your book is very clear and easy to use (I think even for pure dhtml-designers) 3. JSTL really speeds me up
Hi Axel. Thanks for the note - I'm glad you're finding JSTL and JSTL in Action useful.
I have 2 questions: 1. There is no String concenating in JSTL? When I try something like: <cut value="${entry.cat_name + 'something completly different, but a String'}"/> it seems to expect double values for doing adition of numbers.
Right - there's no reason for that kind of concatenation. Instead, simply use two back-to-back <cut> tags.
2. Is it possible to escape " or '? When I tried to dynamize some javaScript calls to build one of those fancy dhtml-navigators, it didn't work first, when I tried something similar to this: <cut value="${'addParent(\"a name\")'}"/> I managed those problems by concenating the Strings I need for the javaScript in the Bean and using the very important escapeXml="false" parameter.
You can escape quotation-mark characters, though it's probably going to be easier simply to use a <cut> tag only to print your dynamic data -- and simply keep your static data in template text. Hope that helps; please let me know if you have any followup questions.
Shawn Bayern<br />"JSTL in Action" <a href="http://www.jstlbook.com" target="_blank" rel="nofollow">http://www.jstlbook.com</a>
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: JSTL: 2 questions: no string concenating? no escaping characters?