This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of Darcy DeClute's Scrum Master Certification Guide: The Definitive Resource for Passing the CSM and PSM Exams and have Darcy DeClute on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

JSTL: 2 questions: no string concenating? no escaping characters?

 
Ranch Hand
Posts: 2166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Author
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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:
<c:out 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 <c:out> 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:
<c:out 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 <c:out> 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.
 
Have you no shame? Have you no decency? Have you no tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic