When to prefer struts over JSTL tags in a JSP presentation? [closed]
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this quest开发者_JAVA百科ionWhen should I not use JSTL tags but struts tags for presentation in jsp?
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.
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.
精彩评论