aspose file tools*
The moose likes Struts and the fly likes JSTL in struts 2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "JSTL in struts 2" Watch "JSTL in struts 2" New topic
Author

JSTL in struts 2

Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
Hi guys, I haven't have time to try it out yet, but if you use JSTL in struts 2 do I still have to download JSTL.jar into my classpath?
or does struts 2 already have it included, that would be awesome if it does. anyone know?

Thanks
Leonardo Carreira
Ranch Hand

Joined: Apr 07, 2009
Posts: 489

AFAIK in struts2 distribution version 2.0.12 the JSTL.jar it doesn't included..
so you have to download it..

i don't know about the higher versions..
Thank's..

Sorry, perhaps my english language isn't too good.. Prepare for SCJP 6, Please God help me.. ☼
References : [Java.Boot] [JavaChamp] [JavaPrepare]
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

S2 doesn't include any JSTL libraries.
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 686



Hi,

Struts 2.0 not include JSTL.

If you are using J2EE 5.0 with your project configuration then you get JSTL included at your class path.



Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
would the S2 tags enough for use so I don't really need to include JSTL? for my S2 project?

Thanks
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

The S2 tags cover most (if not all) of JSTL functionality. Which to use is a matter of opinion and debate.
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 686


Hi,

As David says,

The S2 tags cover most (if not all) of JSTL functionality. Which to use is a matter of opinion and debate.


Yes, that is true, but what about when we use third party tool.


Like inside display tag can we use Struts 2 tag ??

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

What do you mean by "inside display tag"?
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 686

Hi David,

what i mean inside display tag,


if we use <display:column headerClass="Table-Head" property="<s:property name="email />" autolink="true" titleKey="label.system.Email" class="navi-link" />

As i bold, in display column can i use this way ???

That's what i mean ......


David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

No, you can't nest custom tags. (Running it would have answered that question a lot faster.)
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 686

Hi David,

So that's why JSTL need.

That's what i mean.

Because custom tag accept your jsp, screptlet, and JSTL tag. But not accept Struts 2 tag.


SO, some times i think you have to use old technology.

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

No, you can *never* nest custom tags, it doesn't matter what tags they are. You'd need to use JSP EL notation, ${}, which in S2 will check the value stack first.
Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
Hi David

if I didn't download JSTL.jar, can I still use JSP EL ${} or do I use OGNL using '%'?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You can't use OGNL expressions in places that aren't expecting OGNL.

JSTL is a tag library, not an expression language: if your container supports JSP EL (JSP 2+) then you can use JSP EL. You may want to continue non-Struts questions over in the JSP forum.
vishwa venkat
Ranch Hand

Joined: Nov 22, 2003
Posts: 185
With Struts2 if you want to use Display Tag extend the TableDecorator and populate the table properties with Struts2 objects.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JSTL in struts 2