views:

29

answers:

2

Someone can please explain whether to use JSTL tags or struts tags for presentation in jsp ?

+2  A: 

You can use JSTL in any JSP, regardless of whether or not you choose Struts as your web MVC layer.

Struts tags are more specialied; they do you no good if your web MVC layer is Spring or Wicket or something else.

So JSTL means that your JSPs will be more general, usable by any Java web MVC technology that uses JSPs. No so with Struts.

Personally, I would stick with JSTL all the time. I'm not a Struts fan. But if you are wedded to Struts, use only the tags that are absolutely necessary. If it's a choice between a JSTL tag and a Struts tag that does the same thing, I'd choose JSTL to keep my pages portable.

duffymo
thanks @duffymo , when i use struts should i choose struts tags for iterations or jstl tags
Suresh S
A: 

Struts is a MVC framework. JSTL is a "standard" JSP taglib for flow and output control.

If you're already using Struts or any other MVC framework, then I would first look in this corner for useable tags for the particular purpose. If there are none, then head to JSTL. If it doesn't provide it as well, then the particular logic most likely belongs in a Java class rather than a JSP file. Or maybe at highest as an EL function.

BalusC