RE: some comparision between JSP/struts and velocity
If I gave the impression that I thougth otherwise, I apologize - but I agree! :) My point was really in response to Niall (I think), in the vein of thought that, depending on the purpose, you should probably be careful how much hard-coded HTML you put in the taglib if you intend to reuse the taglib in many different designs; that's why as an overall practice it may be better to pull as much HTML out as possible (or necessary) and leave the tag as atomic as possible! In regard to Struts' HTML tags, I think they serve their purpose quite well, if not perfectly. :) Chris -Original Message- From: Martin Cooper [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 01, 2001 5:08 PM To: [EMAIL PROTECTED] Subject: Re: some comparision between JSP/struts and velocity One thing to consider here is the partitioning of functionality across tag libraries. For example, Struts currently has four taglibs - bean, html, logic and template. The tags in the html taglib are the only ones that generate HTML. This was a deliberate design decision, and allows the remaining taglibs to be reused in non-HTML situations. On the ToDo list for Struts 1.1 is a WML taglib. Once that exists, people will be able to create HTML output using the html taglib, or WML output with the wml taglib, and in either case they can continue to use the tags from the bean, logic and template taglibs. I don't think it's a question of whether or not generating HTML from custom tags is a "bad thing". It's more a case of ensuring that the tags - and more specifically the tag libraries - are well designed for their intended purpose. -- Martin Cooper - Original Message - From: "Assenza, Chris" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, July 31, 2001 6:28 AM Subject: RE: some comparision between JSP/struts and velocity > I tend to agree with Tim here, but only in certain circumstances. If you > place very specific HTML code in your tag library then that tag library has > become very restricted in its use - basically it can only be used in the > original context for which it was designed, otherwise the HTML will probably > not match up properly. That makes re-using your taglibs pretty difficult, > at least without re-writing the HTML within each time. > > On the other hand, if you don't care about cross-project reusability, then > embedding HTML into a tag isn't such a bad idea since you only care about it > for the current project and current needs. Personally, I think it's ideal to > generate the minimalist amount of generic HTML as possible in a tag and then > wrap it in HTML on the JSP when you use the tag. Again, that's only if > you're going for maximum reusability. Right now, I've got some HTML > embedded in our tags, but it's very generic HTML that can be used again and > again without much actual change to the Java code itself. :) > > -Chris > > > -----Original Message----- > From: Tim Colson [mailto:[EMAIL PROTECTED]] > Sent: Monday, July 30, 2001 9:20 PM > To: [EMAIL PROTECTED] > Subject: RE: some comparision between JSP/struts and velocity > > > > Niall Pemberton suggested > > ...if the Struts tags dont do what you want then write your > > own. Then you dont have to use scriptlets, you have a re-useable bit of > > functionality, the web designers are happy and you dont have to use > > Velocity. > While a custom tag is an option; this bit of functionality would have > required embedding javascript code and html inside the custom tag lib. To > me, putting view specific code like inside a tag library is also a slippery > slope in the quest to keep thing separated. > > Cheers, > Timothy >
Re: some comparision between JSP/struts and velocity
One thing to consider here is the partitioning of functionality across tag libraries. For example, Struts currently has four taglibs - bean, html, logic and template. The tags in the html taglib are the only ones that generate HTML. This was a deliberate design decision, and allows the remaining taglibs to be reused in non-HTML situations. On the ToDo list for Struts 1.1 is a WML taglib. Once that exists, people will be able to create HTML output using the html taglib, or WML output with the wml taglib, and in either case they can continue to use the tags from the bean, logic and template taglibs. I don't think it's a question of whether or not generating HTML from custom tags is a "bad thing". It's more a case of ensuring that the tags - and more specifically the tag libraries - are well designed for their intended purpose. -- Martin Cooper - Original Message - From: "Assenza, Chris" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, July 31, 2001 6:28 AM Subject: RE: some comparision between JSP/struts and velocity > I tend to agree with Tim here, but only in certain circumstances. If you > place very specific HTML code in your tag library then that tag library has > become very restricted in its use - basically it can only be used in the > original context for which it was designed, otherwise the HTML will probably > not match up properly. That makes re-using your taglibs pretty difficult, > at least without re-writing the HTML within each time. > > On the other hand, if you don't care about cross-project reusability, then > embedding HTML into a tag isn't such a bad idea since you only care about it > for the current project and current needs. Personally, I think it's ideal to > generate the minimalist amount of generic HTML as possible in a tag and then > wrap it in HTML on the JSP when you use the tag. Again, that's only if > you're going for maximum reusability. Right now, I've got some HTML > embedded in our tags, but it's very generic HTML that can be used again and > again without much actual change to the Java code itself. :) > > -Chris > > > -Original Message----- > From: Tim Colson [mailto:[EMAIL PROTECTED]] > Sent: Monday, July 30, 2001 9:20 PM > To: [EMAIL PROTECTED] > Subject: RE: some comparision between JSP/struts and velocity > > > > Niall Pemberton suggested > > ...if the Struts tags dont do what you want then write your > > own. Then you dont have to use scriptlets, you have a re-useable bit of > > functionality, the web designers are happy and you dont have to use > > Velocity. > While a custom tag is an option; this bit of functionality would have > required embedding javascript code and html inside the custom tag lib. To > me, putting view specific code like inside a tag library is also a slippery > slope in the quest to keep thing separated. > > Cheers, > Timothy >
RE: some comparision between JSP/struts and velocity
I tend to agree with Tim here, but only in certain circumstances. If you place very specific HTML code in your tag library then that tag library has become very restricted in its use - basically it can only be used in the original context for which it was designed, otherwise the HTML will probably not match up properly. That makes re-using your taglibs pretty difficult, at least without re-writing the HTML within each time. On the other hand, if you don't care about cross-project reusability, then embedding HTML into a tag isn't such a bad idea since you only care about it for the current project and current needs. Personally, I think it's ideal to generate the minimalist amount of generic HTML as possible in a tag and then wrap it in HTML on the JSP when you use the tag. Again, that's only if you're going for maximum reusability. Right now, I've got some HTML embedded in our tags, but it's very generic HTML that can be used again and again without much actual change to the Java code itself. :) -Chris -Original Message- From: Tim Colson [mailto:[EMAIL PROTECTED]] Sent: Monday, July 30, 2001 9:20 PM To: [EMAIL PROTECTED] Subject: RE: some comparision between JSP/struts and velocity > Niall Pemberton suggested > ...if the Struts tags dont do what you want then write your > own. Then you dont have to use scriptlets, you have a re-useable bit of > functionality, the web designers are happy and you dont have to use > Velocity. While a custom tag is an option; this bit of functionality would have required embedding javascript code and html inside the custom tag lib. To me, putting view specific code like inside a tag library is also a slippery slope in the quest to keep thing separated. Cheers, Timothy
RE: some comparision between JSP/struts and velocity
> There isnt currently javascript in any struts tags (just > attributes for most javascript events) Actually, generates javascript. Devon
RE: some comparision between JSP/struts and velocity
On 30 Jul 2001 18:20:29 -0700, Tim Colson wrote: > While a custom tag is an option; this bit of functionality would have > required embedding javascript code and html inside the custom tag lib. To > me, putting view specific code like inside a tag library is also a slippery > slope in the quest to keep thing separated. Although I would agree that HTML should probably be best kept outside of a taglib, I don't think JavaScript can be generalized that way. JavaScript can sometimes becomes a heavy development task. This is especially the case with client side validation. I think the same thing that motivates a designer to get their scripts from an archive would probably drive them to use developer tag lib. Also, being that JSP and taglibs, like Velocity, is essentially Java, you can still manage view specific code in a designer friendly way, given some though. Calvin
RE: some comparision between JSP/struts and velocity
Timothy, Sorry, I couldnt disagree with you more. Custom tags are exactly the place to put html - they are part of the view, if you look at struts html tags thats what they do. There isnt currently javascript in any struts tags (just attributes for most javascript events) and there are probably browser issues that could complicate this, but its on the Struts to do list to handle client side validation which almost certainly means javascript and tags. Niall > -Original Message- > From: Tim Colson [mailto:[EMAIL PROTECTED]] > Sent: 31 July 2001 02:20 > To: [EMAIL PROTECTED] > Subject: RE: some comparision between JSP/struts and velocity > > > > Niall Pemberton suggested > > ...if the Struts tags dont do what you want then write your > > own. Then you dont have to use scriptlets, you have a re-useable bit of > > functionality, the web designers are happy and you dont have to use > > Velocity. > While a custom tag is an option; this bit of functionality would have > required embedding javascript code and html inside the custom tag lib. To > me, putting view specific code like inside a tag library is also > a slippery > slope in the quest to keep thing separated. > > Cheers, > Timothy >
RE: some comparision between JSP/struts and velocity
> Niall Pemberton suggested > ...if the Struts tags dont do what you want then write your > own. Then you dont have to use scriptlets, you have a re-useable bit of > functionality, the web designers are happy and you dont have to use > Velocity. While a custom tag is an option; this bit of functionality would have required embedding javascript code and html inside the custom tag lib. To me, putting view specific code like inside a tag library is also a slippery slope in the quest to keep thing separated. Cheers, Timothy
RE: some comparision between JSP/struts and velocity
The third wayif the Struts tags dont do what you want then write your own. Then you dont have to use scriptlets, you have a re-useable bit of functionality, the web designers are happy and you dont have to use Velocity. Niall > -Original Message- > From: Tim Colson [mailto:[EMAIL PROTECTED]] > Sent: 31 July 2001 00:55 > To: [EMAIL PROTECTED] > Subject: RE: some comparision between JSP/struts and velocity > > > Scriptlets OK for "view" only? > > Another developer in my group and I discussed this at length last week. I > believe scriptlets in the view to be "bad" practice...or at least > a slippery > slope towards badness. > > I suggest that there are two levels of separation we are trying > to achieve. > > 1) Separation of Business Logic from Display logic > 2) Separation of Developer tasks from Designer tasks > > I'd bet we all mostly agree and accept the first type as good MVC > practice, > and Struts does this quite well. The second type, though, would > be violated > by putting scriptlets into the View, something JSP does not prevent. > > While not violating MVC - the resulting View needs a Designer who knows > Java. > > The counter-argument usually goes like so, "Well, there's > JavaScript on the > page, and the Designer understands that... and the JSP Scriptlet is Java > which kinda looks like JavaScript...ergo, the Designer should be okay with > that too." > > Slippery Slope. The Designer probably copied the JS from a Script archive, > or used a WYSIWIG tool like DreamWeaver to build the script... ;-) > > BTW - the scriptlet was written because the existing taglibs > either couldn't > do what we needed, or at least it was taking too much time to > figure out if > they could. If we had Velocity as an option, I could have written the > necessary bits without the complication of Java in short order. > I'm not sure > the Designer would understand it, but I'm betting I'd have an easier time > explaining the minimal Velocity directives versus the Java > > Cheers, > Tim Colson > > > > > > > >
Re: some comparision between JSP/struts and velocity
Tim Colson wrote: > > Scriptlets OK for "view" only? > > Another developer in my group and I discussed this at length last week. I > believe scriptlets in the view to be "bad" practice...or at least a slippery > slope towards badness. > > I suggest that there are two levels of separation we are trying to achieve. > > 1) Separation of Business Logic from Display logic > 2) Separation of Developer tasks from Designer tasks > > I'd bet we all mostly agree and accept the first type as good MVC practice, > and Struts does this quite well. The second type, though, would be violated > by putting scriptlets into the View, something JSP does not prevent. > > While not violating MVC - the resulting View needs a Designer who knows > Java. > > The counter-argument usually goes like so, "Well, there's JavaScript on the > page, and the Designer understands that... and the JSP Scriptlet is Java > which kinda looks like JavaScript...ergo, the Designer should be okay with > that too." > > Slippery Slope. The Designer probably copied the JS from a Script archive, > or used a WYSIWIG tool like DreamWeaver to build the script... ;-) > > BTW - the scriptlet was written because the existing taglibs either couldn't > do what we needed, or at least it was taking too much time to figure out if > they could. If we had Velocity as an option, I could have written the > necessary bits without the complication of Java in short order. I'm not sure > the Designer would understand it, but I'm betting I'd have an easier time > explaining the minimal Velocity directives versus the Java > > Cheers, > Tim Colson Tim, The current work in JSR-052 (JSP standard tag library -- JSPTL) is trying to address some of these concerns. Namely, our first Early Access release on jakarta-taglibs (http://jakarta.apache.org/taglibs/doc/jsptl-doc/jsptl-ea1/index.html) introduces control flow tags (, , , ) as well as the concept of a simple expression language (with associated tags , , ) to simplify access to application data. The JSR-052 expert group would be really interested in hearing from people in the trenches. Please let us know if we are heading in the right direction. > If we had Velocity as an option, I could have written the > necessary bits without the complication of Java in short order. I'm not sure > the Designer would understand it, but I'm betting I'd have an easier time > explaining the minimal Velocity directives versus the Java In light of the current direction taken by JSPTL EA, could you tell us what your web designers would think of JSPTL? What improvements would be required to fit the bill? Thanks, -- Pierre
RE: some comparision between JSP/struts and velocity
Geir added his perspective, and believe me his view is both wide and knowledgable. :-) > 1) JSP/struts is not comparable to Velocity. Struts is a rich webapp > development framework, and Velocity is a template engine. My group has been working with Struts for a short while, and we have a diagram drawn up to convey this important message so folks don't compare Apples to Oranges. Strut Actions are CONTROLLERs which make business MODEL objects available via the AppContext Layer to JSP's which are used to build the VIEW. Struts-Taglibs are helpful tools for the JSP's to make view building somewhat easier, your mileage may vary, but in the end the VIEW means 'JSP'. In contrast - Velocity is a template language/engine. Nothing more. It does NOT have a controller component. It does NOT obtain Model/Biz Objects directly. It does help a Designer build views based on objects available to them in the Context. In two words - Velocity templates are IMHO "fabulously easy" to use for building Views. Geir lists appropriate comparisons: > Struts/JSP - Turbine/Velocity > Struts/JSP - Turbine/JSP (yes, it does JSP) > Struts/JSP - Turbine/WebMacro > Struts/JSP - Melati/Velocity > Struts/JSP - Melati/WebMacro > Struts/JSP - Maverick/Velocity > Struts/JSP - Luxor/Velocity Another way to phrase this: "Struts as the Controller is normally paired with JSP and Struts Taglibs to produce the View; whereas other Controllers (ex. Turbine, Melati, Maverick, Luxor) can be used with various View tools (ex. JSP, Velocity, WebMacro, XSLT, etc.) I say normally, because I've personally run a version of the Struts example app tweaked by Geir that uses Velocity instead of JSP. It's remarkably easier IMHO to understand the views. My personal opinion is that Struts has a lot of good ideas and is a solid controller. However, I personally feel that if it supported the OPTION to use different View components like Velocity, that this would be a BIG plus. :-) I encourage folks to check out the .war file (http://jakarta.apache.org/builds/jakarta-velocity/contrib/struts/) which is the standard Struts example app - but using Velocity instead of JSP. Cheers, Tim Colson
RE: some comparision between JSP/struts and velocity
Scriptlets OK for "view" only? Another developer in my group and I discussed this at length last week. I believe scriptlets in the view to be "bad" practice...or at least a slippery slope towards badness. I suggest that there are two levels of separation we are trying to achieve. 1) Separation of Business Logic from Display logic 2) Separation of Developer tasks from Designer tasks I'd bet we all mostly agree and accept the first type as good MVC practice, and Struts does this quite well. The second type, though, would be violated by putting scriptlets into the View, something JSP does not prevent. While not violating MVC - the resulting View needs a Designer who knows Java. The counter-argument usually goes like so, "Well, there's JavaScript on the page, and the Designer understands that... and the JSP Scriptlet is Java which kinda looks like JavaScript...ergo, the Designer should be okay with that too." Slippery Slope. The Designer probably copied the JS from a Script archive, or used a WYSIWIG tool like DreamWeaver to build the script... ;-) BTW - the scriptlet was written because the existing taglibs either couldn't do what we needed, or at least it was taking too much time to figure out if they could. If we had Velocity as an option, I could have written the necessary bits without the complication of Java in short order. I'm not sure the Designer would understand it, but I'm betting I'd have an easier time explaining the minimal Velocity directives versus the Java Cheers, Tim Colson
Re: some comparision between JSP/struts and velocity
I did not get the directives in the Velocity - they say #if else #foreach are directives and u can create additional custom directives using velocity macros . They go ahead and tell that this can be used instead of the rich struts tags . It looks they were putting everything in the VelocityContext which is accessed in the .vm pages ( simiar to jsp pages) I did not even get how this going to help in web-based application .Looks very weird when jakarta site was so many -ve remarks about struts when comparing the velocity and struts/jsp . - Original Message - From: Duffey, Kevin To: '[EMAIL PROTECTED]' Sent: Saturday, July 28, 2001 1:42 AM Subject: RE: some comparision between JSP/struts and velocity Totally agree! Exactly what I was thinking when I read that! -Original Message-From: Greg Maletic [mailto:[EMAIL PROTECTED]]Sent: Friday, July 27, 2001 10:45 AMTo: [EMAIL PROTECTED]Subject: RE: some comparision between JSP/struts and velocity This article contains an assertion that goes unquestioned in a lot of the documentation for templating engines, but it's one that seems incorrect to me. After showing an example of some HTML code that contains both Struts tags and a Java scriptlet, the author says: It is clear from the Struts example above that the whole strict MVC model has been broken again because a call to java.util.ArrayList and creating an Object is embedding Java code within a template. To my way of thinking, MVC isn't broken by simply putting Java code into an HTML page. Putting business logic into the HTML page (view) breaks MVC, but the presence of Java code--if used only to support the view--does not. Similarly, I'd argue that it's possible to break MVC even using tags, if the tag implements business logic. (And what is a tag, after all, besides Java code?) Do other people agree? == Greg Maletic Chief Technical Officer Zero G Software, Inc. 514 Bryant Street San Francisco, CA 94107 tel: +1.415.512.7771 x303 fax: +1.415.723.7244 mailto:[EMAIL PROTECTED] http://www.ZeroG.com The leading provider of multi-platform software deployment solutions. == -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of suhasSent: Friday, July 27, 2001 4:40 AMTo: [EMAIL PROTECTED]Subject: some comparision between JSP/struts and velocity http://jakarta.apache.org/velocity/ymtd/ymtd-taglibs.html Suhas
RE: some comparision between JSP/struts and velocity
Totally agree! Exactly what I was thinking when I read that! -Original Message-From: Greg Maletic [mailto:[EMAIL PROTECTED]]Sent: Friday, July 27, 2001 10:45 AMTo: [EMAIL PROTECTED]Subject: RE: some comparision between JSP/struts and velocity This article contains an assertion that goes unquestioned in a lot of the documentation for templating engines, but it's one that seems incorrect to me. After showing an example of some HTML code that contains both Struts tags and a Java scriptlet, the author says: It is clear from the Struts example above that the whole strict MVC model has been broken again because a call to java.util.ArrayList and creating an Object is embedding Java code within a template. To my way of thinking, MVC isn't broken by simply putting Java code into an HTML page. Putting business logic into the HTML page (view) breaks MVC, but the presence of Java code--if used only to support the view--does not. Similarly, I'd argue that it's possible to break MVC even using tags, if the tag implements business logic. (And what is a tag, after all, besides Java code?) Do other people agree? == Greg Maletic Chief Technical Officer Zero G Software, Inc. 514 Bryant Street San Francisco, CA 94107 tel: +1.415.512.7771 x303 fax: +1.415.723.7244 mailto:[EMAIL PROTECTED] http://www.ZeroG.com The leading provider of multi-platform software deployment solutions. == -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of suhasSent: Friday, July 27, 2001 4:40 AMTo: [EMAIL PROTECTED]Subject: some comparision between JSP/struts and velocity http://jakarta.apache.org/velocity/ymtd/ymtd-taglibs.html Suhas
Re: some comparision between JSP/struts and velocity
Hello suhas, Friday, July 27, 2001, 3:40:20 PM, you wrote: s> http://jakarta.apache.org/velocity/ymtd/ymtd-taglibs.html 8) Author of this article take a wrong way to compose struts sample... He (Jon S. Stevens) place a container creation code to the JSP page - yes, such approach not so fine for any application, not only struts based. Struts main approach is to create all business objects in Action class and forward to the JSP view. It is MVC2, not MVC. -- Best regards, Olegmailto:[EMAIL PROTECTED]
RE: some comparision between JSP/struts and velocity
Same view I had also, Although he mentioned that using Velocity with VTL Template Language eleminate the Java code. It doesn't sounds well. I don't really see what's the difference using Struts/Jsp tags instead of Velocity?? Correct me If I'm wrong Sri Thuraisamy -Original Message-From: Greg Maletic [mailto:[EMAIL PROTECTED]]Sent: July 27, 2001 1:45 PMTo: [EMAIL PROTECTED]Subject: RE: some comparision between JSP/struts and velocity This article contains an assertion that goes unquestioned in a lot of the documentation for templating engines, but it's one that seems incorrect to me. After showing an example of some HTML code that contains both Struts tags and a Java scriptlet, the author says: It is clear from the Struts example above that the whole strict MVC model has been broken again because a call to java.util.ArrayList and creating an Object is embedding Java code within a template. To my way of thinking, MVC isn't broken by simply putting Java code into an HTML page. Putting business logic into the HTML page (view) breaks MVC, but the presence of Java code--if used only to support the view--does not. Similarly, I'd argue that it's possible to break MVC even using tags, if the tag implements business logic. (And what is a tag, after all, besides Java code?) Do other people agree? == Greg Maletic Chief Technical Officer Zero G Software, Inc. 514 Bryant Street San Francisco, CA 94107 tel: +1.415.512.7771 x303 fax: +1.415.723.7244 mailto:[EMAIL PROTECTED] http://www.ZeroG.com The leading provider of multi-platform software deployment solutions. == -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of suhasSent: Friday, July 27, 2001 4:40 AMTo: [EMAIL PROTECTED]Subject: some comparision between JSP/struts and velocity http://jakarta.apache.org/velocity/ymtd/ymtd-taglibs.html Suhas
RE: some comparision between JSP/struts and velocity
This article contains an assertion that goes unquestioned in a lot of the documentation for templating engines, but it's one that seems incorrect to me. After showing an example of some HTML code that contains both Struts tags and a Java scriptlet, the author says: It is clear from the Struts example above that the whole strict MVC model has been broken again because a call to java.util.ArrayList and creating an Object is embedding Java code within a template. To my way of thinking, MVC isn't broken by simply putting Java code into an HTML page. Putting business logic into the HTML page (view) breaks MVC, but the presence of Java code--if used only to support the view--does not. Similarly, I'd argue that it's possible to break MVC even using tags, if the tag implements business logic. (And what is a tag, after all, besides Java code?) Do other people agree? == Greg Maletic Chief Technical Officer Zero G Software, Inc. 514 Bryant Street San Francisco, CA 94107 tel: +1.415.512.7771 x303 fax: +1.415.723.7244 mailto:[EMAIL PROTECTED] http://www.ZeroG.com The leading provider of multi-platform software deployment solutions. == -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of suhasSent: Friday, July 27, 2001 4:40 AMTo: [EMAIL PROTECTED]Subject: some comparision between JSP/struts and velocity http://jakarta.apache.org/velocity/ymtd/ymtd-taglibs.html Suhas
Re: some comparision between JSP/struts and velocity
This month's Java Developer's Journal has an article comparing jsp/struts and velocity/turbine. Pretty interesting read, especially since I wasn't too familiar with velocity/turbine. -jason suhas <[EMAIL PROTECTED]> 07/27/2001 06:40 AM Please respond to struts-user To: [EMAIL PROTECTED] cc: Subject:some comparision between JSP/struts and velocity http://jakarta.apache.org/velocity/ymtd/ymtd-taglibs.html Suhas