Re: IF / ELSE and SWITCH/CASE Tags

2001-05-15 Thread Johan Compagner

Great idee's!!
First thing to be included after the final of 1.0??

johan


- Original Message -
From: Niall Pemberton [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, May 15, 2001 8:15 AM
Subject: IF / ELSE and SWITCH/CASE Tags


 Can I submit these logic tags for inclusion in Struts - they are on the
TODO
 list for 1.1?

 Attached are tags to do If/Else and Switch/Case logic, based on existing
 Struts logic tag classes - the key classes inherit from the Struts
 CompareTagBase.

 1) IF/ELSE: (IfTag, ThenTag, ElseTag)

 The IfTag provides the same functionality as the Equal, NotEqual,
LessEqual,
 LessThan, GreaterThan, GreaterEqual, Match, NoMatch, Present, NotPresent
 tags by specifying that in the op attribute.

 Example Usage:

   logic:if op=GreaterThan name=testbean property=doubleProperty
 value=400
   logic:then
 Property Greater Than Value
   /logic:then
   logic:else
 Property Not Greater Than Value
   /logic:else
   /logic:if


 2) SWITCH/CASE: (SwitchTag, CaseTag, DefaultTag)

 Example Usage:

   logic:switch name=testbean property=doubleProperty
 logic:case value =11 matched/logic:case
 logic:case value =321321 matched 1st/logic:case
 logic:case value =321321 matched 2nd/logic:case
 logic:case value =55 matched/logic:case
 logic:defaultNo values matched - default processing/logic:default
   /logic:switch

 [[ LOGIC.ZIP : 1568 in winmail.dat ]]





RE: IF / ELSE and SWITCH/CASE Tags

2001-05-15 Thread Michael Hackett

 1) IF/ELSE: (IfTag, ThenTag, ElseTag)

 The IfTag provides the same functionality as the Equal, NotEqual,
 LessEqual, LessThan, GreaterThan, GreaterEqual, Match, NoMatch,
 Present, NotPresent tags by specifying that in the op attribute.

Why not just continue to use the existing tags for the initial test, and
only add an ELSE tag (used in the same way) to handle the alternate
case? Or, if a symmetrical solution is preferred, one could still use
the THEN tags inside the existing logic test tags.

However, I would actually like to see something more flexible, including
the addition of AND and OR tags for wrapping a set of conditions. Maybe
something like:

logic:conditional
  logic:and
logic:equal name=bean property=myProp value=1/
...
  /logic:and
  logic:onTrue
bean:write ... 
  /logic:onTrue
  logic:onFalse
...
  /logic:onFalse
/logic:conditional

For the simple case, the logic:and might be replaced with a
logic:test, or perhaps the test tag can simply be used in its place,
the AND and OR simply being special case tests with bodies that contain
more tests. If this could be made compatible with the existing system,
without making the new functionality too ugly to use, that would be even
better.

I'm not set on any of the tag names; I just wanted to make clear their
purposes. Suggestions for improvements are welcomed.

--
Michael Hackett
Developer, Pictorius Inc.




RE: [BeanUtils] Need a type conversion hook

2001-05-15 Thread Michael Hackett

 Here's my specific problem.  I am using an Enum
 framework that gives me very nice, fully automatic
 support for Enum types like Gender{Male, Female}. It
 is internationalized, easy to use etc. Each enum type
 is represented by its own class, like
 com.plotix.enums.Gender.

Hi Dmitri,

This Enum framework sounds interesting. Is this something publicly
available, or something you or your company has developed internally. I
would like to take a look at it if it is public. Could you send me a URL
or other contact info, if it is?

Thanks,

--
Michael Hackett
Developer, Pictorius Inc.




Re: IF / ELSE and SWITCH/CASE Tags

2001-05-15 Thread Craig R. McClanahan



On Tue, 15 May 2001, Johan Compagner wrote:

 Great idee's!!

Sounds good to me.  There is also progress on conditional tags in the
Standard Tag Libraries effort that may or may not go in a similar
direction -- but that shouldn't stop us from building on the existing
concepts in the mean time.

 First thing to be included after the final of 1.0??
 

Also sounds good -- I'm going to get 1.0-beta-2 out tonight no matter how
little sleep I end up with  (Tomcat fires took precedence,
unfortunately).

 johan
 
Craig


 
 - Original Message -
 From: Niall Pemberton [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, May 15, 2001 8:15 AM
 Subject: IF / ELSE and SWITCH/CASE Tags
 
 
  Can I submit these logic tags for inclusion in Struts - they are on the
 TODO
  list for 1.1?
 
  Attached are tags to do If/Else and Switch/Case logic, based on existing
  Struts logic tag classes - the key classes inherit from the Struts
  CompareTagBase.
 
  1) IF/ELSE: (IfTag, ThenTag, ElseTag)
 
  The IfTag provides the same functionality as the Equal, NotEqual,
 LessEqual,
  LessThan, GreaterThan, GreaterEqual, Match, NoMatch, Present, NotPresent
  tags by specifying that in the op attribute.
 
  Example Usage:
 
logic:if op=GreaterThan name=testbean property=doubleProperty
  value=400
logic:then
  Property Greater Than Value
/logic:then
logic:else
  Property Not Greater Than Value
/logic:else
/logic:if
 
 
  2) SWITCH/CASE: (SwitchTag, CaseTag, DefaultTag)
 
  Example Usage:
 
logic:switch name=testbean property=doubleProperty
  logic:case value =11 matched/logic:case
  logic:case value =321321 matched 1st/logic:case
  logic:case value =321321 matched 2nd/logic:case
  logic:case value =55 matched/logic:case
  logic:defaultNo values matched - default processing/logic:default
/logic:switch
 
  [[ LOGIC.ZIP : 1568 in winmail.dat ]]
 
 
 




JSR-000126 template/component specification

2001-05-15 Thread Incze Lajos

Maybe some of you on the list are interested or even want to
participate. (Just saw in the news.)

http://java.sun.com/aboutJava/communityprocess/jsr/jsr_126.html
   icnze



RE: cvs commit: jakarta-struts/src/share/org/apache/struts/util RequestUtils.java

2001-05-15 Thread Deadman, Hal

What's the plan regarding forwarding the orignal request instead of the
wrapped request? Form submissions don't work in the current Struts build, at
least not on Weblogic 6.0. If ActionServlet is changed to unwrap the request
before fowarding, Cedric Dumoulin will need to change his Components code
because he has to copy the processForward() method in his class that
inherits from ActionServlet. But then his components framework will only
work with the latest struts builds

Error from weblogic when it tries to dispatch to target using wrapped
request:
java.lang.ClassCastException:
org.apache.struts.upload.MultipartRequestWrapper at
weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImp
l.java:112) at
s1.struts.component.ActionComponentServlet.processForward(ActionComponentSer
vlet.java:198) at
s1.struts.component.ActionComponentServlet.processValidate(ActionComponentSe
rvlet.java:158) at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1553) at
com.tallan.odtos.web.servlet.AppActionServlet.process

Hal

 -Original Message-
 From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
 Sent: Friday, May 11, 2001 7:28 PM
 To: [EMAIL PROTECTED]
 Subject: Re: cvs commit:
 jakarta-struts/src/share/org/apache/struts/util
 RequestUtils.java




 On Fri, 11 May 2001, Martin Cooper wrote:

  At 03:44 PM 5/11/01, Craig R. McClanahan wrote:
 
 
  On 11 May 2001 [EMAIL PROTECTED] wrote:
  
mschachter01/05/11 15:33:38
   
  Modified:src/share/org/apache/struts/action Action.java
ActionServlet.java
   src/share/org/apache/struts/upload
DiskMultipartRequestHandler.java
   src/share/org/apache/struts/util
 RequestUtils.java
  Added:   src/share/org/apache/struts/upload
MultipartRequestWrapper.java
  Log:
   - Added the MultipartRequestWrapper class, which is
 a class that
   implements
 HttpServletRequest and wraps a normal request.  All normal
   HttpServletRequest
 methods will be called to the underlying request,
 except for
   methods involving
 parameters, which were over-ridden to provide a
 transparent way of
   accessing
 multipart elements.  The version of the
 HttpServletRequest is
   Servlet 2.2, however
 the new methods from Servlet 2.3 are also included
 in this class
   with empty
 implementations so that Struts will build against
 the servlet 2.2
   and 2.3 jars
  
  One thing to remember in 2.2 is that you cannot pass your
 wrapped request
  object to a RequestDispatcher.forward() or
 RequestDispatcher.include()
  call.  In Tomcat 3.x, for example, you'd get a
 ClassCastException error if
  you tried to use this in an RD call.
 
  You mean if I have an Action that is invoked via POST with
 a file upload,
  and I try to forward from there using
 mapping.findForward(nextAction),
  where the forward has redirect=false, this will fail? This
 would be very
  bad - in every case where we have a file upload, we
 subsequently forward to
  another action.
 

 As long as you forward the *original* request object (and not the
 wrapper), you're fine.  I'm fighting some security fires on
 Tomcat so I
 haven't had time to look deeply into what Michael is
 changing, but wanted
 to raise the flag in case some assumptions about this were being made
 incorrectly.

  Craig
 
  --
  Martin Cooper
 
 
 

 Craig





Defaults in html:form

2001-05-15 Thread Dmitri Plotnikov

I was implementing file uploading for my application
and for some time instead of the file contents I was
receiving the file name from the browser.  Turns out I
forgot to specify enctype=multipart/form-data in my
html:form tag.  My fault.  

But it got me thinking...

Why wouldn't the enctype of a form default to
multipart/form-data if there was an enclosed
html:file tag?

So, I updated (my local versions) of both FileTag and
FormTag to address this issue. Struts' FormTag
generates the HTML form tag in doStartTag. Since I
needed to be able to override attributes of that tag
from within its body, I changed its superclass from
TagSupport to BodyTagSupport and moved all code
generation into doEndTag.

My FileTag implements this logic: it looks up the
FormTag (fortunately, it is immediately available as a
page context attribute), checks if that FormTag has a
non-null value for the enctype attribute and, if not,
sets it to multipart/form-data.

The changes to the two classes I ended up making are
minor. I could post my versions of the two tags to the
group if you think it is a good idea. Is it?

- Dmitri Plotnikov
[EMAIL PROTECTED]



__
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/