Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is the point of c:out ?

 
Ivan Jouikov
Ranch Hand
Posts: 269
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see a lot of people using things like



Or



What the hell is the point? Isn't it easier to just do:



or



??? Same effect, why the extra writing?
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
first: little point
second: that's the syntax before JSTL 1.1.
In JSTL 1.0 you could not embed EL directly in the code and have the output added to the output stream, it could only be used inside a tag.
As many servers don't support JSTL 1.1 (JSP 2.0) yet, and many people have gotten into the use to use cut, you'll continue to see it.
Myself I find the extra text using cut to add clarity, plus the project uses Tomcat 4.1 which doesn't support JSTL 1.1.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just an example of the ultimate in using JSP tags...
Small JSP which is completely prepared for i18n, not a single word of static text on the page.

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64824
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, <cut/> will, by default, escape special HTML characters to their HTML entitiy equivalents.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic