Logic tags and string properties

2001-05-23 Thread Martin Cooper

It seems that it is not possible to use the logic tags to test is this
property either null or an empty string?. Using logic:present, I can
determine that some value is present, but as far as I can tell, there is no
way to test for an empty string. Specifying value= for tags such as
notEqual seems to result in a complaint that a required attribute has not
been specified. (Is this correct, or is this a bug in Resin, the container
I'm using?)

So, I had a couple of ideas for solving this, and I'd like to hear what
people think.

1) Modify the present and notPresent tags such that the empty string is
equivalent to null for the purposes of this test, if in fact the specified
property is a String. This might break things, though - I'm not sure.

2) Define two new logic tags - perhaps empty and notEmpty - which define
emptiness as a property being either null or the empty string. Unlike
present and notPresent, these tags would only work with the name and
property attributes (i.e. not cookie, parameter, etc), since the others
don't really make sense distinct from present and notPresent.

The second option appeals to me more, because it seems somewhat cleaner than
muddying the definition of presence to include type-specific values.

Comments, anyone?

--
Martin Cooper






Re: Extensions to Struts

2001-05-23 Thread stefan werner

hi,
this sounds very interesting to me.
So, if you don't mind, i'd like to take a look.
regards
stefan werner
- Original Message - 
From: Roland Huss [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, May 22, 2001 10:49 PM
Subject: Extensions to Struts


 Ahoi,
 
 first all thanx for this real fantastic framework, excellent work!.
 We here at ConSol are developing a web frontend for our helpdesk
 software based on struts and for the time being we have about 30
 actions, 35 custom tags, 110 JSP-Pages (without any explicite java
 code!) and appr. 20k lines of Java code and it turned out that struts
 was a great support from the very beginning.
 
 In course of the development during the last three month, we made some
 extensions, which we would happily contribute to struts.
 
 Our extensions are  listed below briefly. If there's some interest
 in some of them, please leave a note (note that I will be absent till
 wednesday in a week, so don't expect a response before)
 
 * Followups. Followups are a simple mechanism for an action to return
   to the place before it was called. Therefore we implemented a
   FollowupStack which is passed around in URLs and Forms (as hidden
   parameters). An action only needs simply to call getFollowup() in its
   perform() method to get a forward to the previous action. (Therefore
   FormTag and Action was extended).
 
 * Action documentation. For documentation of actions, we introduced
   three new javadoc tags: @input (input parameters expected by this
   action in its request) , @output (results put into request scope)
   and @forward (possible forwards of this action). To support these
   new tags we've written two javadoc Doclets: The first is extending
   the standard doclet for rendering an HTML table in the class
   documentation in javadoc. The other one creates XML-output, which we
   use with an XSL stylesheet to convert it to the stylebook DTD for
   the online documentation.
 
 * Hidden Parameters. Our extension of Action has an
   addHiddenParameter() method which put hidden parameters into
   request scope which our subclassed FormTag renders as
   HTML-Tags. With this method it is very easy to push parameters around
   to several actions (without polluting session scope).
 
 * Image Buttons. This an extension to SubmitTag for rendering image
   buttons and handling enabled/disabled buttons based on the existance
   of some object stored in request scope. Our actions can check for the
   trigger of a submit button regardless whether it was submitted as a
   submit button or an image-map.
 
 * Extra parameters in URLs. Our extended Action gives subclasses a
   change to append extra parameters to a forward by overriding a
   getExtraParameters() which will be appended to a forward. 
 
 * From action to JSP. Not really an extension, but it proved for us to be
   very useful to stick to the simple paradigm, that a page is only
   accessed via an action and any JSP-Page is only referenced via an
   action. JSP pages are really only used for rendering the result
   calculated by the previous action, which passes them to the JSP page
   by putting them into request scope. Though it might look rather
   restrictive, this design descision proved to be very useful mainly
   due to its simplicity. 
 
 Well, thats all I remember for the moment. We developed some custom
 tags, which might prove to be useful on its own (and not only for our
 application), but that's another story.
 
 cu
 -- 
 ...roland huss
  consol.de
 




RE: html:errors/ tag

2001-05-23 Thread Muthu Kannappan

Hi
I have written a subclass of org.apache.struts.util.MessageResources  and also
a subclass of org.apache.struts.util.MessageResourcesFactory,
and made my implementation so that when html:errors/ tag is called it gets
the error message from my database instead of the ActionResources.properties
file.

But the problem that I have got now is, How do I set that up in Struts and
which XML file or other file have I to modify.
Could you please help me out in this.

Thanks
Kanna




 
You can subclass org.apache.struts.util.MessageResources to provide your own
database implementation of a resource bundle (as opposed to the common
properties implementation via
org.apache.struts.util.PropertyMessageResources), put an instance of your
subclass in a servlet context (application-scope) attribute, and then use
the html:errors tag's bundle attribute to specify the name you gave to
the servlet context (application-scope) attribute.

At least that should be the theory behind it, though I have not done it
myself.

-- Stoehr

P.S.  You could also have the application resource bundle be an instance of
your MessageResources subclass by creating a subclass of
org.apache.struts.util.MessageResourcesFactory that creates instances of
your MessageResources subclass, and then specify the new factory in the
ActionServlet's factory init parameter.


-Original Message-
From: SESHADRI Sudarshan [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 22, 2001 03:52 AM
To: '[EMAIL PROTECTED]'
Subject: RE: html:errors/ tag


Hi Kanna

please send me the answer if u find it.

thanks

Sudarshan

 tks
 
 Sudarshan
 Tel:  office  : 9218 6823Fax: 9218 6455 / 9218 6916
 Email:  [EMAIL PROTECTED]


-Original Message-
From: Muthu Kannappan [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 23 May 2001 8:42


To: [EMAIL PROTECTED]
Subject: html:errors/ tag


Hi
I have been trying to use struts and wanted to use the html:errors/ tag.
I wanted to the error messages to be read from a database instead of the 
ActionResources properties file. Could you let me know 
what exactly I am suppose to do to achive that. 
I wanted to changed the code at the place where it was looking for the
properties files and make it look into the database.
Could any one suggest me how to do that or has anybody done that already.

Thanks
Kanna



Get free email and a permanent address at http://www.netaddress.com/?N=1



Re: Logic tags and string properties

2001-05-23 Thread Bart Moberts




From: Martin Cooper [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Logic tags and string properties
Date: Wed, 23 May 2001 00:12:59 -0700

It seems that it is not possible to use the logic tags to test is this
property either null or an empty string?. Using logic:present, I can
determine that some value is present, but as far as I can tell, there is no
way to test for an empty string. Specifying value= for tags such as
notEqual seems to result in a complaint that a required attribute has not
been specified. (Is this correct, or is this a bug in Resin, the container
I'm using?)

Tomcat and Orion have no problems with the value= so maybe it is a bug in 
Resin?

Grtz
_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.




RE: html:errors/ tag

2001-05-23 Thread Sukachevin, Stoehr

Sounds like you want the application resource bundle to be an instance of
your MessageResource subclass.  In that case, you should just have to
specify your MessageResourcesFactory subclass fully qualified name for the
factory init parameter of the ActionServlet (see
http://jakarta.apache.org/struts/userGuide/building_controller.html#dd_confi
g_servlet).


-- Stoehr


-Original Message-
From: Muthu Kannappan [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 23, 2001 07:13 PM
To: [EMAIL PROTECTED]
Subject: RE: html:errors/ tag


Hi
I have written a subclass of org.apache.struts.util.MessageResources  and
also
a subclass of org.apache.struts.util.MessageResourcesFactory,
and made my implementation so that when html:errors/ tag is called it gets
the error message from my database instead of the ActionResources.properties
file.

But the problem that I have got now is, How do I set that up in Struts and
which XML file or other file have I to modify.
Could you please help me out in this.

Thanks
Kanna




 
You can subclass org.apache.struts.util.MessageResources to provide your own
database implementation of a resource bundle (as opposed to the common
properties implementation via
org.apache.struts.util.PropertyMessageResources), put an instance of your
subclass in a servlet context (application-scope) attribute, and then use
the html:errors tag's bundle attribute to specify the name you gave to
the servlet context (application-scope) attribute.

At least that should be the theory behind it, though I have not done it
myself.

-- Stoehr

P.S.  You could also have the application resource bundle be an instance of
your MessageResources subclass by creating a subclass of
org.apache.struts.util.MessageResourcesFactory that creates instances of
your MessageResources subclass, and then specify the new factory in the
ActionServlet's factory init parameter.


-Original Message-
From: SESHADRI Sudarshan [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 22, 2001 03:52 AM
To: '[EMAIL PROTECTED]'
Subject: RE: html:errors/ tag


Hi Kanna

please send me the answer if u find it.

thanks

Sudarshan

 tks
 
 Sudarshan
 Tel:  office  : 9218 6823Fax: 9218 6455 / 9218 6916
 Email:  [EMAIL PROTECTED]


-Original Message-
From: Muthu Kannappan [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 23 May 2001 8:42


To: [EMAIL PROTECTED]
Subject: html:errors/ tag


Hi
I have been trying to use struts and wanted to use the html:errors/ tag.
I wanted to the error messages to be read from a database instead of the 
ActionResources properties file. Could you let me know 
what exactly I am suppose to do to achive that. 
I wanted to changed the code at the place where it was looking for the
properties files and make it look into the database.
Could any one suggest me how to do that or has anybody done that already.

Thanks
Kanna



Get free email and a permanent address at http://www.netaddress.com/?N=1



Re: Logic tags and string properties

2001-05-23 Thread Craig R. McClanahan



On Wed, 23 May 2001, Martin Cooper wrote:

 It seems that it is not possible to use the logic tags to test is this
 property either null or an empty string?. Using logic:present, I can
 determine that some value is present, but as far as I can tell, there is no
 way to test for an empty string. Specifying value= for tags such as
 notEqual seems to result in a complaint that a required attribute has not
 been specified. (Is this correct, or is this a bug in Resin, the container
 I'm using?)
 

This is ultimately due to a restriction on the way that

  jsp:setProperty name=beanname property=*/

works, which I copied in the BeanUtils and PropertyUtils classes.  As the
properties are being copied, if the input value is a zero length string,
it is *not* copied.

Changing this behavior now would be very likely to break existing code, so
I think we need to deal with it.  But, your question is more general in
scope because the input beans could come from the application as well.

 So, I had a couple of ideas for solving this, and I'd like to hear what
 people think.
 
 1) Modify the present and notPresent tags such that the empty string is
 equivalent to null for the purposes of this test, if in fact the specified
 property is a String. This might break things, though - I'm not sure.
 
 2) Define two new logic tags - perhaps empty and notEmpty - which define
 emptiness as a property being either null or the empty string. Unlike
 present and notPresent, these tags would only work with the name and
 property attributes (i.e. not cookie, parameter, etc), since the others
 don't really make sense distinct from present and notPresent.
 
 The second option appeals to me more, because it seems somewhat cleaner than
 muddying the definition of presence to include type-specific values.
 

A third option would be to add an empty attribute to the logic:present
and logic:notPresent tags, which tells them how to treat empty
strings.  The default, of course, would be the current behavior.


 Comments, anyone?
 
 --
 Martin Cooper
 
 
 
 

Craig





RE: html:errors/ tag

2001-05-23 Thread Niall Pemberton

I haven't done this, but if you look in the comments at the start of
ActionServlet it say you need to add a factory parameter to the web.xml
file, something like this:

  servlet
servlet-nameaction/servlet-name
servlet-classorg.apache.struts.action.ActionServlet/servlet-class
init-param
  param-nameapplication/param-name
  param-valuemyApp.ApplicationResources/param-value
/init-param
init-param
  param-nameconfig/param-name
  param-value/WEB-INF/struts-config.xml/param-value
/init-param
init-param
  param-namefactory/param-name
  param-valuemyPackage.myMessageResourcesFactory/param-value
/init-param
load-on-startup2/load-on-startup
  /servlet

Niall

 -Original Message-
 From: Muthu Kannappan [mailto:[EMAIL PROTECTED]]
 Sent: 24 May 2001 00:13
 To: [EMAIL PROTECTED]
 Subject: RE: html:errors/ tag


 Hi
 I have written a subclass of
 org.apache.struts.util.MessageResources  and also
 a subclass of org.apache.struts.util.MessageResourcesFactory,
 and made my implementation so that when html:errors/ tag is
 called it gets
 the error message from my database instead of the
 ActionResources.properties
 file.

 But the problem that I have got now is, How do I set that up in Struts and
 which XML file or other file have I to modify.
 Could you please help me out in this.

 Thanks
 Kanna





 You can subclass org.apache.struts.util.MessageResources to
 provide your own
 database implementation of a resource bundle (as opposed to the common
 properties implementation via
 org.apache.struts.util.PropertyMessageResources), put an instance of your
 subclass in a servlet context (application-scope) attribute, and then use
 the html:errors tag's bundle attribute to specify the name you gave to
 the servlet context (application-scope) attribute.

 At least that should be the theory behind it, though I have not done it
 myself.

 -- Stoehr

 P.S.  You could also have the application resource bundle be an
 instance of
 your MessageResources subclass by creating a subclass of
 org.apache.struts.util.MessageResourcesFactory that creates instances of
 your MessageResources subclass, and then specify the new factory in the
 ActionServlet's factory init parameter.


 -Original Message-
 From: SESHADRI Sudarshan [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 22, 2001 03:52 AM
 To: '[EMAIL PROTECTED]'
 Subject: RE: html:errors/ tag


 Hi Kanna

 please send me the answer if u find it.

 thanks

 Sudarshan

  tks
 
  Sudarshan
  Tel:  office  : 9218 6823Fax: 9218 6455 / 9218 6916
  Email:  [EMAIL PROTECTED]


 -Original Message-
 From: Muthu Kannappan [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, 23 May 2001 8:42


 To: [EMAIL PROTECTED]
 Subject: html:errors/ tag


 Hi
 I have been trying to use struts and wanted to use the html:errors/ tag.
 I wanted to the error messages to be read from a database instead of the
 ActionResources properties file. Could you let me know
 what exactly I am suppose to do to achive that.
 I wanted to changed the code at the place where it was looking for the
 properties files and make it look into the database.
 Could any one suggest me how to do that or has anybody done that already.

 Thanks
 Kanna


 
 Get free email and a permanent address at http://www.netaddress.com/?N=1





SourceForge: Project Info - Ruby Web Application Framework

2001-05-23 Thread Incze Lajos

Just interesting. The charter of the project says:

Based on the Jakarta Struts project, the Ruby Web Application framework 
is a framework for developing web/wap applications founded in the Ruby 
programming language.

http://sourceforge.net/projects/ruby-waf/