RE: Contribution: 1) IF, AND, OR, THEN, ELSE, ELSEIF tags 2) SWITCH, CASE, DEFAULT tags
None taken. I dont have a feel for the overhead - could you expand more. Niall -Original Message- From: Wong Kok Wai [mailto:[EMAIL PROTECTED]] Sent: 25 June 2001 06:41 To: [EMAIL PROTECTED] Subject: Re: Contribution: 1) IF, AND, OR, THEN, ELSE, ELSEIF tags 2) SWITCH, CASE, DEFAULT tags No offense, but I feel it is much better in performance to use Java scriptlets for these cases. The overhead of the tags is just too high to justify using them. __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/
Re: Contribution: 1) IF, AND, OR, THEN, ELSE, ELSEIF tags 2) SWITCH, CASE, DEFAULT tags
But tags have one main advantage, the view builder doesn't have to understand Java and it is easy to intergrate the tags in a wysiwyg jsp editor. We use that kind of tags to make our webpages, eg see jsp and all we have to do is to make a xml based editor... with scriplets this is impossible. * begin jsp template:insert template=/document/html.homepage.jsp template:put name=banner content=/element/banner/html.standard.jsp/ wf:choose wf:whenUser level=2 template:put name=leftbar content=/element/leftbar/html.standard_level2.jsp / /wf:whenUser wf:whenUser level=1 template:put name=leftbar content=/element/leftbar/html.standard_level1.jsp / /wf:whenUser wf:otherwise template:put name=leftbar content=/element/leftbar/html.standard.jsp / /wf:otherwise /wf:choose template:put name=content content=/element/content/html.homepage.jsp/ template:put name=menu content=/element/menu/html.homepage.jsp/ /template:insert * end jsp - Original Message - From: Wong Kok Wai [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, June 25, 2001 7:41 AM Subject: Re: Contribution: 1) IF, AND, OR, THEN, ELSE, ELSEIF tags 2) SWITCH, CASE, DEFAULT tags No offense, but I feel it is much better in performance to use Java scriptlets for these cases. The overhead of the tags is just too high to justify using them. __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/
RE: Contribution: 1) IF, AND, OR, THEN, ELSE, ELSEIF tags 2) SWITCH, CASE, DEFAULT tags
Lol! I was just sitting here friday complaining Darn I wish Struts' logic tags supported OR and ELSE! :D Thanks! Chris -Original Message- From: Niall Pemberton [mailto:[EMAIL PROTECTED]] Sent: Sunday, June 24, 2001 4:28 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Contribution: 1) IF, AND, OR, THEN, ELSE, ELSEIF tags 2) SWITCH, CASE, DEFAULT tags Hi, I have extended the IF, THEN, ELSE functionality I posted a while ago to now include AND, OR and ELSEIF tags. I have also added an enhacement to the original CASE tag which now allows an operator as well as value to be specified. I attach the source code for these tags and would like to propose them to be considered for inclusion in Struts. If you agree with including them in Struts, then send some feedback to the development list ([EMAIL PROTECTED]). 1) Tags which make up the IF/ELSE logic are: IfTag AndTag OrTag ThenTag ElseTag ElseifTag 2) Tags which make up the SWITCH/CASE logic are: SwitchTag CaseTag DefaultTag These tags use the same Struts base tags which the existing logic tags use and are effectively just new wrappers to provide IF/ELSE and SWITCH/CASE functionality. The IfTag, AndTag, OrTag and ElseifTag provides the same functionality as the existing Struts logic tags (e.g. EqualTag etc) by specifying an operator (e.g. op=equal) attribute. Valid operator values are: Equal, NotEqual, LessEqual, LessThan, GreaterThan, GreaterEqual, Match. NoMatch, Present, NotPresent The CaseTag also uses an operator attribute and can have the following values: Equal, NotEqual, LessEqual, LessThan, GreaterThan, GreaterEqual Its obvious that trying to specify complex conditional logic in an XML format is never going to have the same clarity as a programming language, so I hope you bear that in mind when seeing how these tags achieve that. Using the IF/ELSE TAGS - I have included a few examples below to demonstrate how to use the tags and I also try document the key points when laying out these tags: How the tags are ordered and embedded in each other is important: 1) The first tag must be an IfTag which encloses all other tags 2) AndTags and OrTags must be embedded after an IfTag or ElseIfTag and before the ThenTag and ElseTag. 3) AndTags can only have OrTags embedded in them 4) OrTags can only have AndTags embedded in them 5) You can't mix and match AndTags and OrTags at the SAME level - must be all AndTags or all OrTags Niall File: amarda-logic.tldFile: logic-src.jar ** Example 1 - IF, OR, THEN, ELSE logic:if name=calendarBean property=month op=equal value=January logic:or name=calendarBean property=year op=LessEqual value=1999/ logic:or name=calendarBean property=day op=equal value=Monday/ logic:then At least one of the above conditions is true. /logic:then logic:else All of Above conditions are false /logic:else /logic:if ** Example 2 - IF, AND, OR, THEN, ELSE, ELSEIF logic:if name=personBean op=present logic:then No details found for this Person /logic:then logic:elseif name=personBean property=age op=GreaterEqual value=16 logic:and name=personBean property=age op=LessEqual value=65 logic:or name=personBean property=age op=LessEqual value=75 logic:and name=personBean property=job op=equal value=Doctor logic:or name=personBean property=job op=equal value=Dentist/ logic:or name=personBean property=job op=equal value=Lawyer/ /logic:and /logic:or logic:or name=personBean property=job op=equal value=President/ logic:or name=personBean property=job op=equal value=Senator/ /logic:and logic:then This person is of working age - that is between the ages of 16 and 65, except for Doctors, Dentists and Lawyers who retire at 55 and presidents and senators who can be any age over 16. /logic:then logic:else This person is either too young to work or past retirement age. /logic:else /logic:elseif /logic:if ** Example 3 - - IF, OR, THEN, ELSE, ELSEIF logic:ifname=calendarBean property=month op=equal value=January logic:or name=calendarBean property=month op=equal value=February/ logic:or name=calendarBean property=month op=equal value=March/ logic:then This if the first quarter of the year. /logic:then logic:elseif name=calendarBean property=month op=equal value=April
RE: Contribution: 1) IF, AND, OR, THEN, ELSE, ELSEIF tags 2) SWITCH, CASE, DEFAULT tags
I agree. Add to that the fact that java script functionality is not consistent across all browsers, and some organizations refuse to allow its use in intranet applications. D -Original Message- From: bram [mailto:[EMAIL PROTECTED]] Sent: Monday, June 25, 2001 5:46 AM To: [EMAIL PROTECTED] Subject: Re: Contribution: 1) IF, AND, OR, THEN, ELSE, ELSEIF tags 2) SWITCH, CASE, DEFAULT tags But tags have one main advantage, the view builder doesn't have to understand Java and it is easy to intergrate the tags in a wysiwyg jsp editor. We use that kind of tags to make our webpages, eg see jsp and all we have to do is to make a xml based editor... with scriplets this is impossible. * begin jsp template:insert template=/document/html.homepage.jsp template:put name=banner content=/element/banner/html.standard.jsp/ wf:choose wf:whenUser level=2 template:put name=leftbar content=/element/leftbar/html.standard_level2.jsp / /wf:whenUser wf:whenUser level=1 template:put name=leftbar content=/element/leftbar/html.standard_level1.jsp / /wf:whenUser wf:otherwise template:put name=leftbar content=/element/leftbar/html.standard.jsp / /wf:otherwise /wf:choose template:put name=content content=/element/content/html.homepage.jsp/ template:put name=menu content=/element/menu/html.homepage.jsp/ /template:insert * end jsp - Original Message - From: Wong Kok Wai [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, June 25, 2001 7:41 AM Subject: Re: Contribution: 1) IF, AND, OR, THEN, ELSE, ELSEIF tags 2) SWITCH, CASE, DEFAULT tags No offense, but I feel it is much better in performance to use Java scriptlets for these cases. The overhead of the tags is just too high to justify using them. __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/
Re: Contribution: 1) IF, AND, OR, THEN, ELSE, ELSEIF tags 2)SWITCH, CASE, DEFAULT tags
On Sun, 24 Jun 2001, Wong Kok Wai wrote: No offense, but I feel it is much better in performance to use Java scriptlets for these cases. The overhead of the tags is just too high to justify using them. Performance is one of the reasons the JSP Standard Tag Libraries effort was started (JSR-052 in the Java Community Process). Once a set of tags are standardized, the JSP page compiler can be made smart enough to create optimized code to implement them (just as it already understands what jsp:useBean means). In particular, conditionals and iteration are going to be included in the first versions of the standard tag library (early access soon). So, it's probably not worth huge amounts of effort to extend the logic tags in Struts, if the standard versions of the tags will meet our needs. Craig McClanahan
RE: Contribution: 1) IF, AND, OR, THEN, ELSE, ELSEIF tags 2) SWITCH, CASE, DEFAULT tags
Just off the top of my head: First, the tag has to be instantiated, then the methods in the Tag interface are called. These already are more than a simple if instruction. Of course, if the JSP compiler can recoqnise these tags and optimises the code generation, then the performance issue will go away. --- Niall Pemberton [EMAIL PROTECTED] wrote: None taken. I dont have a feel for the overhead - could you expand more. Niall __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/
Re: Contribution: 1) IF, AND, OR, THEN, ELSE, ELSEIF tags 2) SWITCH, CASE, DEFAULT tags
No offense, but I feel it is much better in performance to use Java scriptlets for these cases. The overhead of the tags is just too high to justify using them. __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/