Meaningless Drivel is fun!*
The moose likes JSP and the fly likes This week's giveaway Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "This week Watch "This week New topic
Author

This week's giveaway

Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Please give a big welcome to David Geary, author of "Core JSTL: Mastering the JSP Standard Tag Library" who is joing us for the rest of the week. David will be answering your questions about his book and about the JSTL.
On Friday we will be giving away four copies of David's excellent book. All on topic posts between now and Friday will be eligible to win a copy.
Our reviewer (me) gave the book a very good rating of 8 horseshoes and had this to say, "The book describes itself as a 'definitive' guide and that fairly well sums it up. JSTL is covered in excellent detail with lots of examples and sample code. ...overall he does an excellent job of helping to understand how to properly use JSTL."
Posts in this thread will not be eligible so say hi to David here and then start a new thread to ask David your questions.


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
arul murug
Greenhorn

Joined: Aug 08, 2002
Posts: 24
Hi David
Could you please explain me why we should use JSTL instead of Jakarta TagLibs.
we are using tags from tag library developed by us. We are thinking of switching to Jakarta taglibs for our future enhancements.
Thanks


SCJP2<br />SCWCD<br />UML & OOAD - IBM 486
Vedhas Pitkar
Ranch Hand

Joined: Jan 27, 2001
Posts: 445
Hi Will be real glad to win one more free book from javaranch!
Garrett Smith
Ranch Hand

Joined: Jun 27, 2002
Posts: 401
David,
I have read your book 'Advanced JavaServer Pages' and I did learn a good deal from it.
Some of the examples in the book were missing from the zip file on the website, and I had trouble compiling at least one thing (forgot now). I think it could have been edited better.
In writing custom tags, I soon came to the realization that it is best to avoid using them whenever it is possible to use JSTL.
My reasoning:
JSTL is not proprietary, so everyone else doesn't have to learn all your special tags and attributes.
JSTL is already available. Writing custom tags where you could instead use JSTL is a waste of effort. In a way, writing a custom tag can be like rewriting a core class such as ArrayList.

I am looking forward to winning and reading your book.


comp.lang.javascript FAQ: http://jibbering.com/faq/
lina wang
Greenhorn

Joined: Jan 08, 2003
Posts: 3
Hi David:
I bought your book "Graphic Java 2, Volume 2: Swing" about three years ago. It is still one of my most used reference book. Thank you very much for producing such a wonderful book. I am a newer to JSTL and want to know if JSTL database tag supports database store procedure.
I am looking forward to reading your new book.
Roy Tock
Ranch Hand

Joined: Jul 16, 2001
Posts: 83
Hey, David! Andy, Neal, and the rest of us in Brown Deer, WI say hi.
--Roy
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Hey David! Just stopping in from the Swing/JFC/AWT forum.

I really enjoyed your books in the Graphic Java series... in Volume 2 : Swing more books in the series were listed in the front. I haven't seen any past Volume 2 for a long time, though... are any of these further volumes currently planned for release? Or have you moved on to server-side Java exclusively?

Thanks,

-Nate


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Monisha Talwar
Ranch Hand

Joined: Feb 11, 2003
Posts: 102
I plan to prepare for the Web Component Exam. I am sure this book would be very helpful for the preparation. :roll:
Monisha.


Hey! It compiles! Ship it!
manasa teja
Ranch Hand

Joined: May 27, 2002
Posts: 325
Hi David,
Where Can I get sample chapters for this book..
We never used tag libs before. we are plannig to implement a pilot which uses agin taglibs.
Looking forward for your book...

[ April 22, 2003: Message edited by: Mu Ram ]

MT
Bhushan Jawle
Ranch Hand

Joined: Nov 22, 2001
Posts: 249
Welcome and thanks for your time
Francis Siu
Ranch Hand

Joined: Jan 04, 2003
Posts: 867
Hi David
Please read the topic
"Can Java Servlet be implemented with Standard Tag Library"
thanks


Francis Siu
SCJP, MCDBA
Thambi Rajah
Ranch Hand

Joined: Jul 19, 2002
Posts: 36
I plan to buy this book and read on summer.
I hope that I could win it for free.
Thambi
Jim Rock
Ranch Hand

Joined: Mar 20, 2001
Posts: 39
Does the book cover taglibs within a larger framework? Jakarta, Sun taglibs?
Is there a CD with example included
David Geary
Author
Ranch Hand

Joined: Apr 23, 2003
Posts: 45
Originally posted by arul murug:
Hi David
Could you please explain me why we should use JSTL instead of Jakarta TagLibs.
we are using tags from tag library developed by us. We are thinking of switching to Jakarta taglibs for our future enhancements.
Thanks

JSTL is a standard, so it's likely to be supported natively by servlet containers; for example, Resin has a very fast JSTL implementation. Since it's standard, many servlet containers will offer it, so you don't have to lug your own libraries (or Jakarta's) around with you.
Also, realize that Jakarta hosts the JSTL reference implementation; see http://jakarta.apache.org/taglibs/index.html
Finally, JSTL provides core functionality; for more specialized needs, you can use the Jakarta taglibs (for example, the Mailer taglib provides functionality that JSTL does not offer, as opposed to the DBTags, which overlap with JSTL)


David Geary Sabreware, Inc<br /><a href="http://www.corejsf.com" target="_blank" rel="nofollow">http://www.corejsf.com</a><br /> <br />Author: Graphic Java Series, Advanced JavaServerPages, Core JSTL and Core JavaServer Faces
David Geary
Author
Ranch Hand

Joined: Apr 23, 2003
Posts: 45
Originally posted by Garrett Smith:
David,
I have read your book 'Advanced JavaServer Pages' and I did learn a good deal from it.
Some of the examples in the book were missing from the zip file on the website, and I had trouble compiling at least one thing (forgot now). I think it could have been edited better.
In writing custom tags, I soon came to the realization that it is best to avoid using them whenever it is possible to use JSTL.
My reasoning:
JSTL is not proprietary, so everyone else doesn't have to learn all your special tags and attributes.
JSTL is already available. Writing custom tags where you could instead use JSTL is a waste of effort. In a way, writing a custom tag can be like rewriting a core class such as ArrayList.

I am looking forward to winning and reading your book.

Sorry that you had some difficulties with AJSP examples. It's a really difficult to produce a bookful of examples that run under everyone's configuration without some gotchas creeping in. If you send me private email, I'll be glad to help you out.
Regarding custom tags and JSTL, you're absolutely correct: You should, in general, prefer JSTL tags over custom tags, if nothing else, because JSTL is a standard and therefore more easily understood by other developers (and yourself).
When I wrote AJSP, of course, there was no JSTL, so the book puts a pretty heavy emphasis on custom tags.
David Geary
Author
Ranch Hand

Joined: Apr 23, 2003
Posts: 45
Originally posted by lina wang:
Hi David:
I bought your book "Graphic Java 2, Volume 2: Swing" about three years ago. It is still one of my most used reference book. Thank you very much for producing such a wonderful book. I am a newer to JSTL and want to know if JSTL database tag supports database store procedure.
I am looking forward to reading your new book.

Thanks for the kind words on GJ Swing. It's always nice to hear. btw, a new edition of GJ Swing should be out by the end of the year.
JSTL doesn't support stored procedures, but it does support prepared statements and SQL parameters.
JSTL database tags are also one set of tags you might consider doing without because you're directly accessing (and possibly modifying) model data from the view. The JSTL expert group realized that there's no one true way to build web apps, and since the functionality was popular, we included it. But that doesn't mean we were right.
David Geary
Author
Ranch Hand

Joined: Apr 23, 2003
Posts: 45
Originally posted by Nathan Pruett:
Hey David! Just stopping in from the Swing/JFC/AWT forum.

I really enjoyed your books in the Graphic Java series... in Volume 2 : Swing more books in the series were listed in the front. I haven't seen any past Volume 2 for a long time, though... are any of these further volumes currently planned for release? Or have you moved on to server-side Java exclusively?

Thanks,

-Nate

I'm not planning on new volumes for the GJ series, but I am in the process of updating GJ Swing for 1.4. The book will be split in two and the first volume should be out by the end of the year.
The 3rd volume of GJ was going to cover the 2D API, but Vincent Hardy wrote such a great book that I declined to compete with him. I highly recommend his book if you need an in-depth treatment of Java 2D.
Server-side is cool, but I really love Swing.
David Geary
Author
Ranch Hand

Joined: Apr 23, 2003
Posts: 45
Originally posted by Monisha Talwar:
I plan to prepare for the Web Component Exam. I am sure this book would be very helpful for the preparation. :roll:
Monisha.

I certainly don't want to dissuade you from buying a copy if you don't win it, but I don't think JSTL is covered in that exam.
I was one of a handful of Java developers that wrote questions for that exam and JSTL was not finished at that time. Perhaps the exam has recently been updated; if so, I could be wrong.
David Geary
Author
Ranch Hand

Joined: Apr 23, 2003
Posts: 45
Originally posted by Mu Ram:
Hi David,
Where Can I get sample chapters for this book..
We never used tag libs before. we are plannig to implement a pilot which uses agin taglibs.
Looking forward for your book...

[ April 22, 2003: Message edited by: Mu Ram ]

Two Core JSTL sample chapters are available:
Expression language: http://vig.pearsoned.com/samplechapter/0131001531.pdf
URL Actions: http://www.theserverside.com/resources/article.jsp?l=CoreJSTL
David Geary
Author
Ranch Hand

Joined: Apr 23, 2003
Posts: 45
Originally posted by Jim Rock:
Does the book cover taglibs within a larger framework? Jakarta, Sun taglibs?
Is there a CD with example included

The book doesn't cover taglibs outside of JSTL, although I did include an example that uses the Jakarta strings tag library. I find, however, that the Jakarta taglibs are a nice compliment to JSTL.
One of the most important topics covered in the book is the JSTL expression language, which was so popular that the JSP expert group stole it from the JSTL expert group.
You can read that chapter for free at:
http://vig.pearsoned.com/samplechapter/0131001531.pdf
The book doesn't have a CD, but you can download the book's source code from http://www.core-jstl.com. The code's available whether you buy (or win) the book or not.
harold neiper
Greenhorn

Joined: Jun 12, 2002
Posts: 18
Hi David,
I have read this book and I am not sure if it could have been any easier to implement localization without having read your book particularly regarding the difference between the EL and RT based libraries.
Thanks for a great resource!
Harold
Lanny Gilbert
Ranch Hand

Joined: Jun 11, 2002
Posts: 103
Hey, I'd love to win the book. I need all the help I can get. I'm trying to use Weblogic custom tags, but of course they don't port to any other app server.
David Geary
Author
Ranch Hand

Joined: Apr 23, 2003
Posts: 45
Originally posted by harold neiper:
Hi David,
I have read this book and I am not sure if it could have been any easier to implement localization without having read your book particularly regarding the difference between the EL and RT based libraries.
Thanks for a great resource!
Harold

Thanks, I'm glad you found it useful.
JSTL makes localization pretty much a no-brainer, it's so easy to do: just use a properties file and JSTL tags instead of hardcoding local-sensitive information. You can format numbers, dates, currencies, and percents with minimal effort. It's by far the easiest way I've seen to implement internationalized apps.
David Geary
Author
Ranch Hand

Joined: Apr 23, 2003
Posts: 45
Originally posted by Lanny Gilbert:
Hey, I'd love to win the book. I need all the help I can get. I'm trying to use Weblogic custom tags, but of course they don't port to any other app server.

That's JSTL's biggest selling point, of course: it's a standard. And now JSTL's expression language, which is arguably JSTL's crown jewel has been absorbed by the JSP 2.0 specification.
Whether or not you win the book, you can read about the expression language for free here:
http://vig.pearsoned.com/samplechapter/0131001531.pdf
Matthew Phillips
Ranch Hand

Joined: Mar 09, 2001
Posts: 2676
Originally posted by Mu Ram:
Hi David,
Where Can I get sample chapters for this book..
We never used tag libs before. we are plannig to implement a pilot which uses agin taglibs.
Looking forward for your book...

[ April 22, 2003: Message edited by: Mu Ram ]

The Amazon page for "Core JSTL: Mastering the JSP Standard Tag Library" has a look inside link where you can read chapter two of the book.


Matthew Phillips
Kaustubh Patil
Ranch Hand

Joined: Aug 13, 2001
Posts: 164
I am using JSTL.
to create a new variable by using
<c:set var="blnExists" value="true">
now what will the type of the "blnExists" ?
Will it be string or a boolean ?
thanks in advance.
Kaustubh.


Kaustubh. Mumbai, India.
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Originally posted by Kaustubh Patil:
<c:set var="blnExists" value="true">
now what will the type of the "blnExists" ?
Will it be string or a boolean ?

I remember seeing an answer for this question:
It's a java.lang.Object


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
David Geary
Author
Ranch Hand

Joined: Apr 23, 2003
Posts: 45
Originally posted by Kaustubh Patil:
I am using JSTL.
to create a new variable by using
<c:set var="blnExists" value="true">
now what will the type of the "blnExists" ?
Will it be string or a boolean ?
thanks in advance.
Kaustubh.

It will be an instance of java.lang.String, because that's the type of value you specified for the value attribute. It's easy to check:

If you want a boolean, you can do this:

The preceding code prints java.lang.Boolean.
A major use case for the JSTL RT libraries is instantiating Java objects, even though instantiating Java objects in JSP pages is questionable design. Here's another example that uses the format RT library to format the current date:

(c;out above should be c colon out, but that sequence of characters generates smiley faces, even when embedded in [CODE] tags)
David Geary
Author
Ranch Hand

Joined: Apr 23, 2003
Posts: 45
Originally posted by harold neiper:
Hi David,
I have read this book and I am not sure if it could have been any easier to implement localization without having read your book particularly regarding the difference between the EL and RT based libraries.
Thanks for a great resource!
Harold

Like most people, I rarely use the RT libraries. Perhaps the most compelling reason to use them is instantiating Java objects in JSP pages, although MVC purists will certainly disdain that practice in the first place. Formatting the current date is one example where it makes sense to use the RT libraries because you need to have a Java Date object on hand for <fmt:formatDate>.

david
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Originally posted by David Geary:

If you want a boolean, you can do this:

The preceding code prints java.lang.Boolean.


Someone claimed it'd be an Object in this thread. David, could you point me to the correct place in the JSTL specification where this behavior is explained?
Daniel Ng
Greenhorn

Joined: Jul 09, 2002
Posts: 27
Hi David,
Is there a section in your book that list all the JSTL tags, and their functionality?
Thanx,
Daniel
Kathy Wang
Greenhorn

Joined: Sep 06, 2001
Posts: 28
I am pretty new to JSTL. It seems for me it is a combination of scripting language and tag ligrary. Hope I can get a chance to read your book! Aand use what you teach in the book sometime. Thanks
David Geary
Author
Ranch Hand

Joined: Apr 23, 2003
Posts: 45
Originally posted by Daniel Ng:
Hi David,
Is there a section in your book that list all the JSTL tags, and their functionality?
Thanx,
Daniel

Yes, there's a reference section that's about 90 pages (the book's 580). The reference section lists all of the tags, shows legal syntax and attributes, and a section on error handling. There's also an In a Nutshell section that discusses key aspects of each tag.
David Geary
Author
Ranch Hand

Joined: Apr 23, 2003
Posts: 45
Originally posted by Kathy Wang:
I am pretty new to JSTL. It seems for me it is a combination of scripting language and tag ligrary. Hope I can get a chance to read your book! Aand use what you teach in the book sometime. Thanks

Your characterization is correct: JSTL is an expression language and a set of tag libraries. The expression language, as of JSP 2.0, is part of the JSP specification.
JSTL makes it much easier to develop web applications, and lets you, for the most part, avoid Java code in your JSP pages, which is good modular design.
David Geary
Author
Ranch Hand

Joined: Apr 23, 2003
Posts: 45
Originally posted by Lasse Koskela:

If you want a boolean, you can do this:

The preceding code prints java.lang.Boolean.
<hr></blockquote>

Someone claimed it'd be an Object in this thread. David, could you point me to the correct place in the JSTL specification where this behavior is explained?[/QB]

You specify an object for the value attribute, which <c:set> coerces to a String. From page 4-26 of the spec:
"The result of the evaluation is coerced to a String and is subsequently emitted into the current JspWriter object."
You can specify any type of object with <c:set>'s value attribute, for example:

Here, I've used an Integer to specify the value. The <c:set> tag, as the spec states above, coerces that object to a String.
The confusion probably stems from the tables in the spec that document the tags; for <c:set>, they list Object as the type for the value attribute. That means the type you specify, not what the final type is. <c:set> always coerces that object into a string.
[ April 24, 2003: Message edited by: David Geary ]
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Thanks for the explanation, David.
Yingtang Tang
Ranch Hand

Joined: Nov 27, 2001
Posts: 42
David,
I borrowed your books, "Core JSTL" and "Advanced JavaServer Pages" from library. Both of them are referenced a lot in my project. I hope to win one copy from here. Thanks for your excellent work.
Best regards,
Yingtang
[ April 24, 2003: Message edited by: Yingtang Tang ]
Gavin Bong
Ranch Hand

Joined: Apr 25, 2003
Posts: 56
David,
A few questions:
a) What is the relation between JSTL and JSF ?
b) Does JSTL tags supercede those of Struts ?
c) Does JSTL provide the ability to skin websites (i.e. themes, look and feel)
Thanks
Gavin
noel angel
Ranch Hand

Joined: Oct 27, 2002
Posts: 75
Would love to win a copy of this book. I put it in my wish list on Amazon! I'll keep wishing.
Noel
SCJP1.4
SCWCD
David Geary
Author
Ranch Hand

Joined: Apr 23, 2003
Posts: 45
Originally posted by Gavin Bong:
David,
A few questions:
a) What is the relation between JSTL and JSF ?
b) Does JSTL tags supercede those of Struts ?
c) Does JSTL provide the ability to skin websites (i.e. themes, look and feel)
Thanks
Gavin

JSTL is a set of tag libraries and an expression language. It lets you implement JSP pages without resorting to scriptlets.
JSF (JavaServer Faces) is a server-side component framework similar to Struts combined with custom components like trees, calendars, etc.
JSTL does not provide skinning, but it's a good bet that JSF will in the future.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: This week's giveaway
 
Similar Threads
* Welcome David Berube
Welcome David Berube
This week's giveaway!
Welcome Dave Thomas and David Heinemeier Hansson
Welcome Pete Goodliffe