aspose file tools*
The moose likes JSP and the fly likes Integration with JSTL and Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Integration with JSTL and Struts" Watch "Integration with JSTL and Struts" New topic
Author

Integration with JSTL and Struts

Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561
Hi guys..
Now that I've seen Shawn B. around I'd like to ask a question regarding these two technologies (or frameworks).
I've read somewhere that the integration between JSTL and Struts is not as good as a developer can expect. Unfortunately, I do not the reasons why people say that.
I've used the mailer tag lib and I think it is excellent and easy to use. Now I'm thinking to start my new project with the Struts framework and would like to know some opinions of you guys regarding this.
Is it easy to integrate?
thank you


I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
Shawn Bayern
Author
Ranch Hand

Joined: May 06, 2002
Posts: 160
Originally posted by Andres Gonzalez:
Hi guys..
Now that I've seen Shawn B. around I'd like to ask a question regarding these two technologies (or frameworks).

Hi Andres!

I've read somewhere that the integration between JSTL and Struts is not as good as a developer can expect. Unfortunately, I do not the reasons why people say that.
I've used the mailer tag lib and I think it is excellent and easy to use. Now I'm thinking to start my new project with the Struts framework and would like to know some opinions of you guys regarding this.

Note that it is very important to avoid confusing JSTL with Jakarta Taglibs. JSTL is a standard from the Java Community Process. Jakarta Taglibs is an open-source project that contains many custom tag libraries. The confusion perhaps comes from the fact that Jakarta Taglibs offers an implementation of JSTL called the "Standard Taglib," as one of its many taglibs. But other vendors, like any JCP standard (such as the Servlet API or JSP itself), will offer implementations as well.
As another difference, Jakarta Taglibs has been around for years, while JSTL is new -- it was just released this June/July.
Just to be clear, the Mailer Taglib from Jakarta Taglibs is not part of JSTL.
To answer your question, I suspect that the things you've heard about integration with struts apply to Jakarta Taglibs and not really to JSTL. Jakarta Taglibs was never aggressively intended to integrate with Struts; overall, perhaps there should be more integration among Jakarta projects, but it's still common for two projects not to work well together. Jakarta Taglibs does provide some offerings that don't make sense to use with Struts.
JSTL, by contrast, should work with Struts perfectly. The only issue is when Struts will begin to adopt the expression language and, perhaps a little further away, the JSTL tags for flow control, i18n, and so on. But no issues are expected; Craig and I have discussed this in the past, and I don't suspect any technical problems. In fact, the standard API that JSP 2.0 adds for accessing the JSTL expression language was designed to make it easy for frameworks like Struts (and, also, JavaServer Faces) to use the JSTL expression language.
Please let me know if you've got any further questions. I think it's important to make sure that people know that JSTL isn't Jakarta Taglibs.
[ August 20, 2002: Message edited by: Shawn Bayern ]

Shawn Bayern<br />"JSTL in Action" <a href="http://www.jstlbook.com" target="_blank" rel="nofollow">http://www.jstlbook.com</a>
Eric Peterson
Ranch Hand

Joined: Jan 08, 2002
Posts: 31
Shawn,
My question is twofold. 1) Where can I go to learn more about JSTL? 2) How does using JSTL compare to using Jakarta's Taglibs, or anyone else's taglibs for that matter, in regards to separating presentation from business logic and data?
Thanks.


Eric Peterson
Shawn Bayern
Author
Ranch Hand

Joined: May 06, 2002
Posts: 160
Originally posted by Eric Peterson:
Shawn,
My question is twofold. 1) Where can I go to learn more about JSTL?

Hi Eric,
http://java.sun.com/products/jstl is Sun's official page on JSTL.
http://www.jstlbook.com is my book's site; my book serves as an introduction to every feature of JSTL. The index, contents, and a few sample chapters are available from http://www.manning.com/bayern
2) How does using JSTL compare to using Jakarta's Taglibs, or anyone else's taglibs for that matter, in regards to separating presentation from business logic and data?

Most people are likely to prefer JSTL for two reasons:
- It was designed carefully, with industry consensus, substantial debate and feedback. Its design took into account MVC as well as the fundamental separation of business logic from presentation. (Still, it doesn't require that you use an MVC approach.)
- It is a standard, meaning that you learn it once and rely on its presence across multiple containers. Books, articles, and other high-quality educational materials can be made available, making your pages more likely to be easily maintained by someone else (and your skills more likely reused across multiple projects). Also, containers can recognize the standard JSTL tags and optimize their implementation, making them potentially faster than other nonstandard tags.
Hope that helps,
Thanks.
[ August 20, 2002: Message edited by: Shawn Bayern ]
Pete Cassetta
Greenhorn

Joined: Feb 13, 2001
Posts: 23
Originally posted by Eric Peterson:
Shawn,
2) How does using JSTL compare to using Jakarta's Taglibs, or anyone else's taglibs for that matter, in regards to separating presentation from business logic and data?
Thanks.

Eric,
Separating logic and data from presentation is a bigger issue than just using a tag library. For most non-trivial applications, you will want to utilize a Web application framework such as Struts to help in making a clean separation.
There are a multitude of such frameworks (see The Wafer Project), and many of them do not even use JSP for the view layer. If you are writing a non-trivial application, do some research and settle on a framework first. If it allows JSP for the view layer, then see what tag libraries it provides, recommends, or allows. At that point you are ready to consider supplementing your toolkit with JSTL and possibly other tag libraries.
In my opinion, the momentum tag libraries are gaining is one of the big advantages of utilizing JSP for your view layer. There are already many useful tag libraries out there (such as JSTL and Jakarta Taglibs) which I incorporate into projects, and I'm quite sure the number of available tag libraries is going to mushroom in the coming months/years. This is the main reason I am reluctant to stray too far from JSP.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Integration with JSTL and Struts
 
Similar Threads
struts-faces.jar
Why Jakarta Struts?
Struts without JSP
Apache Struts 2 Web App Dev question: easy to integrate with Seam?
Can struts 2 and an older version co-exist?