File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes What is the point of c:out  ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "What is the point of c:out  ?" Watch "What is the point of c:out  ?" New topic

What is the point of c:out ?

Ivan Jouikov
Ranch Hand

Joined: Jul 22, 2003
Posts: 269
I see a lot of people using things like


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


??? Same effect, why the extra writing?
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
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

Joined: Oct 12, 2000
Posts: 5093
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

Joined: Jan 10, 2002
Posts: 63870

Also, <cut/> will, by default, escape special HTML characters to their HTML entitiy equivalents.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: What is the point of c:out ?
It's not a secret anymore!