RE: Newbie struggling with struts-example

2003-08-16 Thread Mike Steigerwald
D'oh! I'm supposed to be smarter than that!

 

(Sheepish grin)

 

Thanks, that did the trick.

 

Mike Steigerwald

9237 Pinehurst Road

Woodbury, MN 55125-8642

[EMAIL PROTECTED]

Phone: 651.261.2098

Fax: 206-237-6597

http://home.comcast.net/~michaels23/

 

-Original Message-
From: Benjamin Cox [mailto:[EMAIL PROTECTED] 
Sent: Saturday, August 16, 2003 6:46 PM
To: [EMAIL PROTECTED]
Subject: Re: Newbie struggling with struts-example

 

Hmmm...  did you expand the .war file?  From in the webapps directory, try:

jar -xf struts-example.war

then hit your page again.

If that doesn't work, there may be a configuration setting in Tomcat that
has turned off automatic creation of contexts when they are placed in the
webapps directory, though it's not very likely.  

Oh, one other thing:  if you are using Apache as the bridge then, depending
how it is configured, you may possibly have to put another entry in the
configuration file for the connector (like mod_jk.conf), since Tomcat is not
handling the URLs by itself when attached to Apache.

Good luck,

  Ben

Mike Steigerwald wrote:



Thanks, but I get the same error. (Except that it now refers to
struts-example/tour.htm
 
Mike Steigerwald
9237 Pinehurst Road
Woodbury, MN 55125-8642
[EMAIL PROTECTED]
Phone: 651.261.2098
Fax: 206-237-6597
http://home.comcast.net/~michaels23/
 
 
-Original Message-
From: Benjamin Cox [mailto:[EMAIL PROTECTED] 
Sent: Saturday, August 16, 2003 4:28 PM
To: Struts Developers List
Subject: Re: Newbie struggling with struts-example
 
Each of the applications you install into tomcat (i.e. with a .war file) 
is, by default, deployed into its own context, which allows different 
applications to co-exist in one server happily. Each context is accessed 
from a url like:  http://yourHost/warFilenameWithoutTheDotWar/.  In 
tomcat, the application at / is typically called ROOT, a directory for 
which should be in your webapps directory.  However, you can configure 
any application to be the root application.
 
So, in your case, if your .war  file is called struts-example.war, and 
your host is localhost, you'd access your tour.htm file via the URL:  
 
  http://localhost/struts-example/tour.htm
 
rather than:
 
  http://localhost/tour.htm
 
Give that a shot, since, based on your posting, I doubt you've 
configured struts-example to be the root context.
 
P.S.  I'm pretty sure that users _would_ be a more appropriate place, 
but not 100%.
 
Hope it helps,
 
  Ben
 
Mike Steigerwald wrote:
 
  

Hi, all,
 
I'm trying to teach myself struts using the example. I'm already stuck. I
don't know if this is a struts issue or a tomcat issue. Not wanting to
cross-post, I'll start here.
 
I've downloaded the struts-example from the 1.1 stable release. I mounted
the .war file into the NetBeans project. When I try to execute tour.htm, I
get this error from tomcat:
 
Apache Tomcat/4.0.6 - HTTP Status 404 - /tour.htm
 
---


-
  


 
type Status report
 
message /tour.htm
 
description The requested resource (/tour.htm) is not available.
 
---


-
  


 
I'm sure I've missed a step in the installation and deployment, but
re-tracing my steps hasn't helped. Can anyone help me fill in the blanks?
 
PS - Would the struts-user list be a more appropriate place to post
questions like this?
 
Thanks, in advance.
 
Mike Steigerwald
9237 Pinehurst Road
Woodbury, MN 55125-8642
[EMAIL PROTECTED]
Phone: 651.261.2098
Fax: 206-237-6597
http://home.comcast.net/~michaels23/
 
 
 
 
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 


 
 
 
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 
 
  

 



Re: parameter vs. set-property (was Re: Flexible form support)

2003-08-16 Thread Robert Leland
Sgarlata Matt wrote:

Robert Leland wrote:

Sgarlata Matt wrote:

What do you think?  Would this be a reasonable enhancement request?  
Can I post it in BugZilla with patches? 


Since you have talked about it on the struts-user group, and it looks 
like the existing system makes your
life harder, then open a Bugzilla request. What ever committer looks 
at the bug request will determine if the patch will be applied or 
modified.
[Patches] are always welcome and speed the process ! If possible 
patch against the current HEAD of struts source
code. Use the diff -u old new. I also like to use 'diff -u 5 old new' 
just to be sure.


I've never used CVS before so I don't know what you mean.  What is the 
current HEAD of struts source code mean?  
HEAD/CVS

The HEAD means the most current version of source code of by default the 
TRUNK.
This source can be downloaded from 
http://cvs.apache.org/builds/jakarta-struts/nightly/src/

IF I had said 'submit patches against the HEAD of the STRUTS_1_1_BRANCH, 
then
you would have to use CVS directly to get to this source.

The Mozilla site has a nice graphic
http://www.mozilla.org/roadmap/branching-2003-06-24.png
of  Trunks and Branches.
So if you would like provide patches against the most recient
source code, http://cvs.apache.org/builds/jakarta-struts/nightly/src/
You can use the commons jars found in the struts nightly build
found at the binary is at 
http://cvs.apache.org/builds/jakarta-struts/nightly
to build and test your patches. If you haven't built struts before
the only file you'll need to modify is the build.properties file
which just a copy of the build.properties.sample file.


The Jakarta site says

cvs diff -u Main.java >> patchfile.txt

is preferred.  Can I use that instead?
DIFF
If you are NOT using CVS then you'll need to use the command
diff -u 4 file1.old.java file1.new.java  >> file1.diff
IF you are using windows then you'll need to install Cygwin
to get the 'diff' program.
If you are using are using CVS then I  yes use the
cvs diff -u 4 file1.java >> file1.diff command.
-Rob



-Rob




--
Robert Leland   [EMAIL PROTECTED]
--
Java, J2EE, Struts, Web Application Development
804 N. Kenmore Street   +01-703-525-3580
Arlington VA 22201


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Newbie struggling with struts-example

2003-08-16 Thread Benjamin Cox
Each of the applications you install into tomcat (i.e. with a .war file) 
is, by default, deployed into its own context, which allows different 
applications to co-exist in one server happily. Each context is accessed 
from a url like:  http://yourHost/warFilenameWithoutTheDotWar/.  In 
tomcat, the application at / is typically called ROOT, a directory for 
which should be in your webapps directory.  However, you can configure 
any application to be the root application.

So, in your case, if your .war  file is called struts-example.war, and 
your host is localhost, you'd access your tour.htm file via the URL:  

 http://localhost/struts-example/tour.htm

rather than:

 http://localhost/tour.htm

Give that a shot, since, based on your posting, I doubt you've 
configured struts-example to be the root context.

P.S.  I'm pretty sure that users _would_ be a more appropriate place, 
but not 100%.

Hope it helps,

 Ben

Mike Steigerwald wrote:

Hi, all,

I'm trying to teach myself struts using the example. I'm already stuck. I
don't know if this is a struts issue or a tomcat issue. Not wanting to
cross-post, I'll start here.
I've downloaded the struts-example from the 1.1 stable release. I mounted
the .war file into the NetBeans project. When I try to execute tour.htm, I
get this error from tomcat:
Apache Tomcat/4.0.6 - HTTP Status 404 - /tour.htm



type Status report

message /tour.htm

description The requested resource (/tour.htm) is not available.



I'm sure I've missed a step in the installation and deployment, but
re-tracing my steps hasn't helped. Can anyone help me fill in the blanks?
PS - Would the struts-user list be a more appropriate place to post
questions like this?
Thanks, in advance.

Mike Steigerwald
9237 Pinehurst Road
Woodbury, MN 55125-8642
[EMAIL PROTECTED]
Phone: 651.261.2098
Fax: 206-237-6597
http://home.comcast.net/~michaels23/


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


DO NOT REPLY [Bug 22486] - [PATCH] Give MessageResources a reference to MessageResourcesConfig

2003-08-16 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22486

[PATCH] Give MessageResources a reference to MessageResourcesConfig

[EMAIL PROTECTED] changed:

   What|Removed |Added

   Keywords||PatchAvailable



--- Additional Comments From [EMAIL PROTECTED]  2003-08-16 20:42 ---
Added PatchAvailable to the keywords

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 22486] - [PATCH] Give MessageResources a reference to MessageResourcesConfig

2003-08-16 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22486

[PATCH] Give MessageResources a reference to MessageResourcesConfig





--- Additional Comments From [EMAIL PROTECTED]  2003-08-16 20:42 ---
Created an attachment (id=7854)
Patch for MessageResources

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 22486] - [PATCH] Give MessageResources a reference to MessageResourcesConfig

2003-08-16 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22486

[PATCH] Give MessageResources a reference to MessageResourcesConfig





--- Additional Comments From [EMAIL PROTECTED]  2003-08-16 20:41 ---
Created an attachment (id=7853)
Patch for the action servlet

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 22486] New: - [PATCH] Give MessageResources a reference to MessageResourcesConfig

2003-08-16 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22486

[PATCH] Give MessageResources a reference to MessageResourcesConfig

   Summary: [PATCH] Give MessageResources a reference to
MessageResourcesConfig
   Product: Struts
   Version: Nightly Build
  Platform: All
OS/Version: All
Status: NEW
  Severity: Enhancement
  Priority: Other
 Component: Utilities
AssignedTo: [EMAIL PROTECTED]
ReportedBy: [EMAIL PROTECTED]


The  element doesn't work very well for the  
element.  The reason for this is that  populates a 
MessageResourcesConfig object instead of the actual MessageResources object.  
Then in the ActionServlet, when the MessageResources object is initialized it 
is passed the "parameter" information but is not passed any  
information:

// here the resources are created, and passed the parameter
MessageResources resources =
factoryObject.createResources(mrcs[i].getParameter());
// here the resources are passed the return null info
resources.setReturnNull(mrcs[i].getNull());
//!! here I think we should pass the MessageResourcesConfig
getServletContext().setAttribute(
mrcs[i].getKey() + config.getPrefix(),
resources); 

The patch I will attach in a moment adds resources.setMessageResourcesConfig to 
ActionServlet where I put //!! in the comments.  To support this behavior, I 
introduced a protected messageResourcesConfig object (with getters and setters) 
to MessageResources.

Food for thought - will commons-resources support behavior like this, where the 
resources know their configuration information?  I looked through the javadoc 
as best I could but I couldn't tell.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: parameter vs. set-property (was Re: Flexible form support)

2003-08-16 Thread Sgarlata Matt
Robert Leland wrote:
Sgarlata Matt wrote:

What do you think?  Would this be a reasonable enhancement request?  
Can I post it in BugZilla with patches? 
Since you have talked about it on the struts-user group, and it looks 
like the existing system makes your
life harder, then open a Bugzilla request. What ever committer looks at 
the bug request will determine if the patch will be applied or modified.
[Patches] are always welcome and speed the process ! If possible patch 
against the current HEAD of struts source
code. Use the diff -u old new. I also like to use 'diff -u 5 old new' 
just to be sure.
I've never used CVS before so I don't know what you mean.  What is the 
current HEAD of struts source code mean?  The Jakarta site says

cvs diff -u Main.java >> patchfile.txt

is preferred.  Can I use that instead?

-Rob

--
Matthew Sgarlata
Senior Consultant
Booz Allen Hamilton Inc.
Work: 703-377-0871
Fax: 703-902-3608
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Newbie struggling with struts-example

2003-08-16 Thread Mike Steigerwald
Hi, all,

I'm trying to teach myself struts using the example. I'm already stuck. I
don't know if this is a struts issue or a tomcat issue. Not wanting to
cross-post, I'll start here.

I've downloaded the struts-example from the 1.1 stable release. I mounted
the .war file into the NetBeans project. When I try to execute tour.htm, I
get this error from tomcat:

Apache Tomcat/4.0.6 - HTTP Status 404 - /tour.htm




type Status report

message /tour.htm

description The requested resource (/tour.htm) is not available.




I'm sure I've missed a step in the installation and deployment, but
re-tracing my steps hasn't helped. Can anyone help me fill in the blanks?

PS - Would the struts-user list be a more appropriate place to post
questions like this?

Thanks, in advance.

Mike Steigerwald
9237 Pinehurst Road
Woodbury, MN 55125-8642
[EMAIL PROTECTED]
Phone: 651.261.2098
Fax: 206-237-6597
http://home.comcast.net/~michaels23/




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: MultipartRequestWrapper and HttpServletRequest parameters

2003-08-16 Thread Benjamin Cox
Craig R. McClanahan wrote:

The current plan of record has been that Struts 1.2.x would stay dependent
on Servlet 2.2 / JSP 1.1, and that Struts 2.x would be dependent on
Servlet 2.4 / JSP 2.0.
It's certainly fair to lobby for changes in this plan, and/or to look for
ways to implement something like this in an optionally different way on a
Servlet 2.3 platform that has wrappers and filters available.  The people
you'd have to convince (the committers) are all on the developer list, but
most of us also monitor user list discussions.
Thanks, Craig.  This is definitely illuminating.

I assume from this response that the issue _will_ be resolved once this 
move takes place.  Do you have any idea how we might begin to implement 
a workaround for Struts 1.2.x?  Does this seem as though it will require 
disproportionate work and/or modifications to other portions of the 
codebase?

 Ben && Tim



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


cvs commit: jakarta-struts/src/share/org/apache/struts/validator DynaValidatorForm.java

2003-08-16 Thread dgraham
dgraham 2003/08/16 11:56:20

  Modified:src/share/org/apache/struts/validator DynaValidatorForm.java
  Log:
  Fixed minor javadoc formatting.
  
  Revision  ChangesPath
  1.12  +27 -27
jakarta-struts/src/share/org/apache/struts/validator/DynaValidatorForm.java
  
  Index: DynaValidatorForm.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/validator/DynaValidatorForm.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- DynaValidatorForm.java10 Jul 2003 04:01:47 -  1.11
  +++ DynaValidatorForm.java16 Aug 2003 18:56:20 -  1.12
  @@ -98,44 +98,44 @@
*/
   private static Log log = LogFactory.getLog(DynaValidatorForm.class);
   
  -   /**
  +/**
* The results returned from the validation performed
* by the Validator.
*/
   protected ValidatorResults validatorResults = null;
   
  -   /**
  +/**
* Used to indicate the current page of a multi-page form.
*/
   protected int page = 0;
   
  -   /**
  +/**
* Gets page.
  -* @return page number.
  + * @return page number.
*/
   public int getPage() {
   return page;
   }
   
  -   /**
  +/**
* Sets page.
  -* @param page page number
  + * @param page page number
*/
   public void setPage(int page) {
   this.page = page;
   }
   
   /**
  -  * Validate the properties that have been set from this HTTP request,
  -  * and return an ActionErrors object that encapsulates any
  -  * validation errors that have been found.  If no errors are found, return
  -  * null or an ActionErrors object with no
  -  * recorded error messages.
  -  *
  -  * @param mapping The mapping used to select this instance.
  -  * @param request The servlet request we are processing.
  -  * @return ActionErrors object that encapsulates any validation 
errors.
  -  */
  + * Validate the properties that have been set from this HTTP request,
  + * and return an ActionErrors object that encapsulates any
  + * validation errors that have been found.  If no errors are found, return
  + * null or an ActionErrors object with no
  + * recorded error messages.
  + *
  + * @param mapping The mapping used to select this instance.
  + * @param request The servlet request we are processing.
  + * @return ActionErrors object that encapsulates any validation 
errors.
  + */
   public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) 
{
   this.setPageFromDynaProperty();
   
  @@ -172,7 +172,7 @@
   }
   }
   
  -   /**
  +/**
* Reset all properties to their default values.
*
* @param mapping The mapping used to select this instance
  @@ -184,30 +184,30 @@
   validatorResults = null;
   }
   
  -   /**
  +/**
* Get results of the validation performed by the
* Validator.
  -* @return validator results as ValidatorResults object
  + * @return validator results as ValidatorResults object
*/
   public ValidatorResults getValidatorResults() {
   return validatorResults;
   }
   
  -   /**
  +/**
* Set results of the validation performed by the
* Validator.
  -* @param validatorResults  Set results of the validation performed
  + * @param validatorResults  Set results of the validation performed
*/
   public void setValidatorResults(ValidatorResults validatorResults) {
   this.validatorResults = validatorResults;
   }
   
  -   /**
  +/**
* Returns a Map of values returned
* from any validation that returns a value other than
* null or Boolean with the
* key the full property path of the field.
  -* @return Returns a Map of values, otherwise returns null if no 
results.
  + * @return Returns a Map of values, otherwise returns null if no 
results.
*/
   public Map getResultValueMap() {
   return (validatorResults != null ? validatorResults.getResultValueMap() : 
null);
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-struts/src/share/org/apache/struts/action DynaActionForm.java

2003-08-16 Thread dgraham
dgraham 2003/08/16 11:54:03

  Modified:src/share/org/apache/struts/action DynaActionForm.java
  Log:
  Added getString() and getStrings() methods to make it easier to retrieve
  String and String[] properties from the form.
  
  Revision  ChangesPath
  1.9   +39 -7 
jakarta-struts/src/share/org/apache/struts/action/DynaActionForm.java
  
  Index: DynaActionForm.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/action/DynaActionForm.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DynaActionForm.java   10 Apr 2003 02:35:28 -  1.8
  +++ DynaActionForm.java   16 Aug 2003 18:54:03 -  1.9
  @@ -59,17 +59,17 @@
*
*/
   
  -
   package org.apache.struts.action;
   
  -
   import java.lang.reflect.Array;
   import java.util.HashMap;
   import java.util.Iterator;
   import java.util.List;
   import java.util.Map;
  +
   import javax.servlet.ServletRequest;
   import javax.servlet.http.HttpServletRequest;
  +
   import org.apache.commons.beanutils.ConversionException;
   import org.apache.commons.beanutils.DynaBean;
   import org.apache.commons.beanutils.DynaClass;
  @@ -94,7 +94,6 @@
* @version $Revision$ $Date$
* @since Struts 1.1
*/
  -
   public class DynaActionForm extends ActionForm implements DynaBean {
   
   
  @@ -330,7 +329,40 @@
   }
   
   }
  +
  +/**
  + * Return the value of a String property with the specified name.
  + * This is equivalent to calling (String) dynaForm.get(name).
  + * 
  + * @param name Name of the property whose value is to be retrieved
  + *
  + * @throws IllegalArgumentException if there is no property
  + *  of the specified name
  + * @throws NullPointerException if the type specified for the
  + *  property is invalid
  + * @throws ClassCastException if the property is not a String.
  + * @since Struts 1.2
  + */
  +public String getString(String name) {
  +return (String) this.get(name);
  +}
   
  +/**
  + * Return the value of a String[] property with the specified name.
  + * This is equivalent to calling (String[]) dynaForm.get(name).
  + *
  + * @param name Name of the property whose value is to be retrieved
  + *
  + * @throws IllegalArgumentException if there is no property
  + *  of the specified name
  + * @throws NullPointerException if the type specified for the
  + *  property is invalid
  + * @throws ClassCastException if the property is not a String[].
  + * @since Struts 1.2
  + */
  +public String[] getStrings(String name) {
  +return (String[]) this.get(name);
  +}
   
   /**
* Return the DynaClass instance that describes the set of
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: MultipartRequestWrapper and HttpServletRequest parameters

2003-08-16 Thread Craig R. McClanahan
On Sat, 16 Aug 2003, Benjamin Cox wrote:

> Date: Sat, 16 Aug 2003 11:38:53 -0700
> From: Benjamin Cox <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>,
>  [EMAIL PROTECTED]
> To: Struts Developers List <[EMAIL PROTECTED]>,
>  [EMAIL PROTECTED]
> Cc: Tim Ruppert <[EMAIL PROTECTED]>
> Subject: Re: MultipartRequestWrapper and HttpServletRequest parameters
>
> Struts-Users group:  Please see below for our original issue... sorry to
> cross-post this one, but I wasn't sure we did the right thing by posting
> to struts-dev in the first place.  Will someone set us straight?
>
> Gaining more information on this issue:  we tried to subclass
> RequestProcessor and refrain from unwrapping the original
> HttpServletRequest in the doForward() method before forwarding the
> request along.  However, there are other places where the original
> HttpServletRequest is retrieved, such as in
> org.apache.struts.taglib.beans.ParameterTag.
>
> It is when this ParameterTag tries to retrieve the parameters from the
> HttpServletRequest that an exception is thrown.  It retrieves its
> HttpServletRequest directly from the javax.servlet.jsp.PageContext.  The
> required parameter "returnto" is not found in this request, since all
> parameters were parsed into the MultipartRequestWrapper, which
> presumably cannot replace the request contained in the PageContext.
>
> We've noticed a lot of documentation in the source around this issue
> which seems to indicate that a move to the Servlet 2.3 specification
> will cause MultipartRequestWrapper to play a little more nicely with the
> J2EE spec.  Once this happens, MultipartRequestWrapper will apparently
> be changed into a subclass of HttpServletRequestWrapper.
>
> Will this change will result in the MultipartRequestWrapper being
> returned from the J2EE spec methods which currently return the
> HttpServletRequest?
>
> If so, when do we anticipate the move to Servlet 2.3?
>

The current plan of record has been that Struts 1.2.x would stay dependent
on Servlet 2.2 / JSP 1.1, and that Struts 2.x would be dependent on
Servlet 2.4 / JSP 2.0.

It's certainly fair to lobby for changes in this plan, and/or to look for
ways to implement something like this in an optionally different way on a
Servlet 2.3 platform that has wrappers and filters available.  The people
you'd have to convince (the committers) are all on the developer list, but
most of us also monitor user list discussions.

> Thanks,
>
>   Ben && Tim
>

Craig


>
>
> Benjamin Cox wrote:
>
> > Hello all,
> >
> > We are having some trouble with multipart uploads and validation.  A
> > similar problem was described in:
> > http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]&msgId=740076
> >
> >
> > Our problem is an attempt to validate a form that includes a file
> > upload.  Our ActionForm successfully returns the correct set of
> > ActionErrors when a field is missing, but then provides the following
> > exception when it tries to display the form again ('returnto' is one
> > of our hidden form fields):
> > javax.servlet.jsp.JspException: No parameter returnto was included in
> > this request
> >
> > We've traced through the source code and determined that a
> > MultipartRequestWrapper is being created around our HttpServletRequest
> > when we perform a file upload via multipart/form-data.  This
> > MultipartRequestWrapper, while it contains the original
> > HttpServletRequest, handles parsing and storing of the request
> > parameters on its own.  This is helpful, indeed, except that when the
> > RequestProcessor forwards the request to another action (such as after
> > validation), it does not forward the MultipartRequestWrapper, but the
> > original HttpServletRequest, which was never populated with any
> > parameters!
> >
> > The original, never-populated HttpServletRequest is unwrapped on line
> > 1058-1060 of org.apache.struts.action.RequestProcessor, and forwarded
> > on the chain via RequestDispatcher.forward().  Naturally, this causes
> > the next step in the chain (sending back a form with errors) to fail,
> > since it relies on the missing parameters to populate the form fields.
> >
> > Our current workaround is to utilize JavaScript to append the request
> > parameters to the form action string before submitting it, but we'd
> > prefer for the HttpServletRequest to be populated, if at all possible.
> > Though the J2EE spec does not indicate setParameter() as one of its
> > methods, does anyone know if there is any way "behind the scenes" to
> > get this request object populated?  Or, would it be possible to pass
> > the MultipartRequestWrapper back as-is?
> >
> > Thanks for any insight,
> >
> >  Ben Cox (&& Tim Ruppert)
> >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
>
> -
> To uns

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

2003-08-16 Thread dgraham
dgraham 2003/08/16 11:45:15

  Modified:src/share/org/apache/struts/util ModuleException.java
  Log:
  Added getActionMessage() to replace the getError() method.
  
  Revision  ChangesPath
  1.2   +32 -3 
jakarta-struts/src/share/org/apache/struts/util/ModuleException.java
  
  Index: ModuleException.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/util/ModuleException.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ModuleException.java  8 Dec 2002 06:04:42 -   1.1
  +++ ModuleException.java  16 Aug 2003 18:45:15 -  1.2
  @@ -1,7 +1,7 @@
   /*
* The Apache Software License, Version 1.1
*
  - * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
  @@ -55,13 +55,25 @@
   package org.apache.struts.util;
   
   import org.apache.struts.action.ActionError;
  +import org.apache.struts.action.ActionMessage;
   
   /**
* Used for specialized exception handling.
*/
   public class ModuleException extends Exception {
  +
   protected String property = null;
  +
  +/**
  + * @deprecated Use message instead.
  + */
   protected ActionError error = null;
  +
  +/**
  + * The ActionMessage associated with this exception.
  + * @since Struts 1.2
  + */
  +protected ActionMessage message = null;
   
/**
 * Construct an module exception with no replacement values.
  @@ -71,6 +83,7 @@
   public ModuleException(String key) {
   super(key);
error = new ActionError(key);
  +message = new ActionMessage(key);
   }
   
/**
  @@ -82,6 +95,7 @@
public ModuleException(String key, Object value) {
super(key);
error = new ActionError(key, value);
  +message = new ActionMessage(key, value);
}
   
/**
  @@ -94,6 +108,7 @@
public ModuleException(String key, Object value0, Object value1) {
super(key);
error = new ActionError(key, value0, value1);
  +message = new ActionMessage(key, value0, value1);
}
   
/**
  @@ -107,6 +122,7 @@
public ModuleException(String key, Object value0, Object value1, Object 
value2) {
super(key);
error = new ActionError(key, value0, value1, value2);
  +message = new ActionMessage(key, value0, value1, value2);
}
   
/**
  @@ -121,6 +137,7 @@
public ModuleException(String key, Object value0, Object value1, Object 
value2, Object value3) {
super(key);
error = new ActionError(key, value0, value1, value2, value3);
  +message = new ActionMessage(key, value0, value1, value2, value3);
}
   
/**
  @@ -131,14 +148,15 @@
 */
public ModuleException(String key, Object[] values) {
error = new ActionError(key, values);
  +message = new ActionMessage(key, values);
}
  - //  Public Methods
  +
   /**
 * Returns the property associated with the exception.
 * @return Value of property.
 */
public String getProperty() {
  - return (property != null) ? property : error.getKey();
  + return (property != null) ? property : message.getKey();
}
   
   /**
  @@ -152,8 +170,19 @@
   /**
 * Returns the error associated with the exception.
 * @return Value of property error.
  + * @deprecated Use getActionMessage() instead.  This will be removed
  + * after Struts 1.2.
 */
public ActionError getError() {
return error;
}
  +
  +/**
  + * Returns the error associated with the exception.
  + * @return Value of property error.
  + * @since Struts 1.2
  + */
  +public ActionMessage getActionMessage() {
  +return this.message;
  +}
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: MultipartRequestWrapper and HttpServletRequest parameters

2003-08-16 Thread Benjamin Cox
Struts-Users group:  Please see below for our original issue... sorry to 
cross-post this one, but I wasn't sure we did the right thing by posting 
to struts-dev in the first place.  Will someone set us straight?

Gaining more information on this issue:  we tried to subclass 
RequestProcessor and refrain from unwrapping the original 
HttpServletRequest in the doForward() method before forwarding the 
request along.  However, there are other places where the original 
HttpServletRequest is retrieved, such as in 
org.apache.struts.taglib.beans.ParameterTag.

It is when this ParameterTag tries to retrieve the parameters from the 
HttpServletRequest that an exception is thrown.  It retrieves its 
HttpServletRequest directly from the javax.servlet.jsp.PageContext.  The 
required parameter "returnto" is not found in this request, since all 
parameters were parsed into the MultipartRequestWrapper, which 
presumably cannot replace the request contained in the PageContext.

We've noticed a lot of documentation in the source around this issue 
which seems to indicate that a move to the Servlet 2.3 specification 
will cause MultipartRequestWrapper to play a little more nicely with the 
J2EE spec.  Once this happens, MultipartRequestWrapper will apparently 
be changed into a subclass of HttpServletRequestWrapper. 

Will this change will result in the MultipartRequestWrapper being 
returned from the J2EE spec methods which currently return the 
HttpServletRequest?

If so, when do we anticipate the move to Servlet 2.3?

Thanks,

 Ben && Tim



Benjamin Cox wrote:

Hello all,

We are having some trouble with multipart uploads and validation.  A 
similar problem was described in: 
http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]&msgId=740076 

Our problem is an attempt to validate a form that includes a file 
upload.  Our ActionForm successfully returns the correct set of 
ActionErrors when a field is missing, but then provides the following 
exception when it tries to display the form again ('returnto' is one 
of our hidden form fields):  
javax.servlet.jsp.JspException: No parameter returnto was included in 
this request

We've traced through the source code and determined that a 
MultipartRequestWrapper is being created around our HttpServletRequest 
when we perform a file upload via multipart/form-data.  This 
MultipartRequestWrapper, while it contains the original 
HttpServletRequest, handles parsing and storing of the request 
parameters on its own.  This is helpful, indeed, except that when the 
RequestProcessor forwards the request to another action (such as after 
validation), it does not forward the MultipartRequestWrapper, but the 
original HttpServletRequest, which was never populated with any 
parameters!

The original, never-populated HttpServletRequest is unwrapped on line 
1058-1060 of org.apache.struts.action.RequestProcessor, and forwarded 
on the chain via RequestDispatcher.forward().  Naturally, this causes 
the next step in the chain (sending back a form with errors) to fail, 
since it relies on the missing parameters to populate the form fields.

Our current workaround is to utilize JavaScript to append the request 
parameters to the form action string before submitting it, but we'd 
prefer for the HttpServletRequest to be populated, if at all possible.
Though the J2EE spec does not indicate setParameter() as one of its 
methods, does anyone know if there is any way "behind the scenes" to 
get this request object populated?  Or, would it be possible to pass 
the MultipartRequestWrapper back as-is?

Thanks for any insight,

 Ben Cox (&& Tim Ruppert)

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


cvs commit: jakarta-struts/src/share/org/apache/struts/config ConfigHelper.java

2003-08-16 Thread dgraham
dgraham 2003/08/16 11:38:56

  Modified:src/share/org/apache/struts/config ConfigHelper.java
  Log:
  Replaced ActionError with ActionMessage.
  
  Revision  ChangesPath
  1.10  +6 -6  
jakarta-struts/src/share/org/apache/struts/config/ConfigHelper.java
  
  Index: ConfigHelper.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/ConfigHelper.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ConfigHelper.java 8 Aug 2003 23:26:36 -   1.9
  +++ ConfigHelper.java 16 Aug 2003 18:38:56 -  1.10
  @@ -71,12 +71,12 @@
   import javax.sql.DataSource;
   
   import org.apache.struts.Globals;
  -import org.apache.struts.action.ActionError;
   import org.apache.struts.action.ActionErrors;
   import org.apache.struts.action.ActionForm;
   import org.apache.struts.action.ActionFormBean;
   import org.apache.struts.action.ActionForward;
   import org.apache.struts.action.ActionMapping;
  +import org.apache.struts.action.ActionMessage;
   import org.apache.struts.action.ActionMessages;
   import org.apache.struts.upload.MultipartRequestWrapper;
   import org.apache.struts.util.MessageResources;
  @@ -743,7 +743,7 @@
   }
   
   while (reports.hasNext()) {
  -ActionError report = (ActionError) reports.next();
  +ActionMessage report = (ActionMessage) reports.next();
   message = getMessage(report.getKey(), report.getValues());
   if (message != null) {
   results.append(message);
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-struts/src/share/org/apache/struts/action ActionErrors.java

2003-08-16 Thread dgraham
dgraham 2003/08/16 11:37:33

  Modified:src/share/org/apache/struts/action ActionErrors.java
  Log:
  Deprecated add() method.
  
  Revision  ChangesPath
  1.12  +6 -5  
jakarta-struts/src/share/org/apache/struts/action/ActionErrors.java
  
  Index: ActionErrors.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/action/ActionErrors.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ActionErrors.java 15 Apr 2003 00:18:45 -  1.11
  +++ ActionErrors.java 16 Aug 2003 18:37:33 -  1.12
  @@ -85,7 +85,6 @@
* @author Craig R. McClanahan
* @version $Revision$ $Date$
*/
  -
   public class ActionErrors extends ActionMessages implements Serializable {
   
   // - Manifest Constants
  @@ -122,6 +121,8 @@
*
* @param property Property name (or ActionErrors.GLOBAL_ERROR)
* @param error The error message to be added
  + * @deprecated Use add(String, ActionMessage) instead.  This will be
  + * removed after Struts 1.2.
*/
   public void add(String property, ActionError error) {
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-struts/src/share/org/apache/struts/taglib TagUtils.java

2003-08-16 Thread dgraham
dgraham 2003/08/16 11:35:41

  Modified:src/share/org/apache/struts/taglib TagUtils.java
  Log:
  Replaced ActionError with ActionMessage.
  
  Revision  ChangesPath
  1.23  +6 -7  jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java
  
  Index: TagUtils.java
  ===
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- TagUtils.java 2 Aug 2003 22:19:37 -   1.22
  +++ TagUtils.java 16 Aug 2003 18:35:41 -  1.23
  @@ -83,7 +83,6 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   import org.apache.struts.Globals;
  -import org.apache.struts.action.ActionError;
   import org.apache.struts.action.ActionErrors;
   import org.apache.struts.action.ActionMessage;
   import org.apache.struts.action.ActionMessages;
  @@ -645,12 +644,12 @@
   } else if (value instanceof String) {
   errors.add(
   ActionErrors.GLOBAL_ERROR,
  -new ActionError((String) value));
  +new ActionMessage((String) value));
   
   } else if (value instanceof String[]) {
   String keys[] = (String[]) value;
   for (int i = 0; i < keys.length; i++) {
  -errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(keys[i]));
  +errors.add(ActionErrors.GLOBAL_ERROR, new 
ActionMessage(keys[i]));
   }
   
   } else if (value instanceof ActionErrors) {
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-struts/src/validator/org/apache/struts/webapp/validator TypeAction.java RegistrationAction.java MultiRegistrationAction.java

2003-08-16 Thread dgraham
dgraham 2003/08/16 11:33:24

  Modified:src/validator/org/apache/struts/webapp/validator
TypeAction.java RegistrationAction.java
MultiRegistrationAction.java
  Log:
  Formatted, removed unused variables, bad imports.
  
  Revision  ChangesPath
  1.4   +38 -41
jakarta-struts/src/validator/org/apache/struts/webapp/validator/TypeAction.java
  
  Index: TypeAction.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/validator/org/apache/struts/webapp/validator/TypeAction.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TypeAction.java   9 Oct 2002 14:14:12 -   1.3
  +++ TypeAction.java   16 Aug 2003 18:33:24 -  1.4
  @@ -1,7 +1,7 @@
   /*
* The Apache Software License, Version 1.1
*
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
  @@ -52,32 +52,29 @@
* .
*/
   
  -
   package org.apache.struts.webapp.validator;
   
  -import java.util.Locale;
  -import javax.servlet.http.HttpSession;
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;
  +import javax.servlet.http.HttpSession;
  +
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   import org.apache.struts.action.Action;
   import org.apache.struts.action.ActionForm;
   import org.apache.struts.action.ActionForward;
   import org.apache.struts.action.ActionMapping;
  -import org.apache.struts.util.MessageResources;
  -
   
   /**
* Implementation of Action that validates a different 'types'.
*
* @author David Wintefeldt
  -*/
  + */
   public final class TypeAction extends Action {
   
   /**
* Commons Logging instance.
  -*/
  + */
   private Log log = 
LogFactory.getFactory().getInstance(this.getClass().getName());
   
   /**
  @@ -95,31 +92,28 @@
* @return Action to forward to
* @exception Exception if an input/output error or servlet exception occurs
*/
  -public ActionForward execute(ActionMapping mapping,
  - ActionForm form,
  - HttpServletRequest request,
  - HttpServletResponse response)
  -throws Exception {
  -
  -// Extract attributes we will need
  -HttpSession session = request.getSession();
  -Locale locale = getLocale(request);
  -MessageResources messages = getResources(request);
  -TypeForm info = (TypeForm)form;
  -String action = request.getParameter("action");
  -
  -// Was this transaction cancelled?
  -if (isCancelled(request)) {
  -if (log.isInfoEnabled()) {
  -   log.info(" " + mapping.getAttribute() + " - Type transaction was 
cancelled");
  -}
  +public ActionForward execute(
  +ActionMapping mapping,
  +ActionForm form,
  +HttpServletRequest request,
  +HttpServletResponse response)
  +throws Exception {
  +
  +// Was this transaction cancelled?
  +if (isCancelled(request)) {
  +if (log.isInfoEnabled()) {
  +log.info(
  +" "
  ++ mapping.getAttribute()
  ++ " - Type transaction was cancelled");
  +}
   
  -removeFormBean(mapping, request);
  +removeFormBean(mapping, request);
   
  -return (mapping.findForward("success"));
  -}
  +return mapping.findForward("success");
  +}
   
  -return mapping.findForward("success");
  +return mapping.findForward("success");
   }
   
   /**
  @@ -127,16 +121,19 @@
*
* @param mapping The ActionMapping used to select this instance
* @param request The HTTP request we are processing
  -*/
  -protected void removeFormBean(ActionMapping mapping, HttpServletRequest 
request) {
  -   // Remove the obsolete form bean
  -   if (mapping.getAttribute() != null) {
  -   if ("request".equals(mapping.getScope())) {
  -   request.removeAttribute(mapping.getAttribute());
  -   } else {
  -  HttpSession session = request.getSession();
  -  session.removeAttribute(mapping.getAttribute());
  -   }
  -   }
  + */
  +protected void removeFormBean(
  +ActionMapping mapping,
  +HttpServletRequest request) {
  +
  +// Remove the obsolete form bean
  +if (mapping.getAttribute() != null) {
  +if ("request".equals(mapping.getScope())) {
  +request.removeAttribute(mapping.getAttribute());
  +} else {
  +HttpSession session = 

cvs commit: jakarta-struts/src/upload/org/apache/struts/webapp/upload UploadForm.java

2003-08-16 Thread dgraham
dgraham 2003/08/16 11:30:27

  Modified:src/upload/org/apache/struts/webapp/upload UploadForm.java
  Log:
  Formatted, replaced ActionError with ActionMessage.
  
  Revision  ChangesPath
  1.9   +21 -21
jakarta-struts/src/upload/org/apache/struts/webapp/upload/UploadForm.java
  
  Index: UploadForm.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/upload/org/apache/struts/webapp/upload/UploadForm.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- UploadForm.java   28 Feb 2003 02:18:23 -  1.8
  +++ UploadForm.java   16 Aug 2003 18:30:27 -  1.9
  @@ -61,17 +61,15 @@
   
   package org.apache.struts.webapp.upload;
   
  -
   import javax.servlet.http.HttpServletRequest;
   
  -import org.apache.struts.action.ActionError;
   import org.apache.struts.action.ActionErrors;
   import org.apache.struts.action.ActionForm;
   import org.apache.struts.action.ActionMapping;
  +import org.apache.struts.action.ActionMessage;
   import org.apache.struts.upload.FormFile;
   import org.apache.struts.upload.MultipartRequestHandler;
   
  -
   /**
* This class is a placeholder for form values.  In a multipart request, files are 
represented by
* set and get methods that use the class org.apache.struts.upload.FormFile, an 
interface with
  @@ -82,11 +80,10 @@
* @author Mike Schachter
* @version $Revision$ $Date$
*/
  -
  -public class UploadForm extends ActionForm
  -{
  -public static final String ERROR_PROPERTY_MAX_LENGTH_EXCEEDED = 
"org.apache.struts.webapp.upload.MaxLengthExceeded";
  -
  +public class UploadForm extends ActionForm {
  +
  +public static final String ERROR_PROPERTY_MAX_LENGTH_EXCEEDED =
  +"org.apache.struts.webapp.upload.MaxLengthExceeded";
   
   /**
* The value of the text the user has sent as form data
  @@ -113,8 +110,6 @@
*/
   protected String filePath;
   
  -
  -
   /**
* Retrieve the value of the text the user has sent as form data
*/
  @@ -193,16 +188,21 @@
* Check to make sure the client hasn't exceeded the maximum allowed upload 
size inside of this
* validate method.
*/
  -public ActionErrors validate(ActionMapping mapping, HttpServletRequest request)
  -{
  +public ActionErrors validate(
  +ActionMapping mapping,
  +HttpServletRequest request) {
  +
   ActionErrors errors = null;
   //has the maximum length been exceeded?
  -Boolean maxLengthExceeded = (Boolean)
  -
request.getAttribute(MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED);
  -if ((maxLengthExceeded != null) && (maxLengthExceeded.booleanValue()))
  -{
  +Boolean maxLengthExceeded =
  +(Boolean) request.getAttribute(
  +MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED);
  +
  +if ((maxLengthExceeded != null) && (maxLengthExceeded.booleanValue())) {
   errors = new ActionErrors();
  -errors.add(ERROR_PROPERTY_MAX_LENGTH_EXCEEDED, new 
ActionError("maxLengthExceeded"));
  +errors.add(
  +ERROR_PROPERTY_MAX_LENGTH_EXCEEDED,
  +new ActionMessage("maxLengthExceeded"));
   }
   return errors;
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-struts/src/example/org/apache/struts/webapp/example SubscriptionForm.java SaveSubscriptionAction.java SaveRegistrationAction.java RegistrationForm.java LogonAction.java LogoffAction.java EditSubscriptionAction.java EditRegistrationAction.java

2003-08-16 Thread dgraham
dgraham 2003/08/16 11:29:09

  Modified:src/example/org/apache/struts/webapp/example
SubscriptionForm.java SaveSubscriptionAction.java
SaveRegistrationAction.java RegistrationForm.java
LogonAction.java LogoffAction.java
EditSubscriptionAction.java
EditRegistrationAction.java
  Log:
  Formatting, bad imports, changed ActionError to ActionMessage.
  
  Revision  ChangesPath
  1.5   +12 -11
jakarta-struts/src/example/org/apache/struts/webapp/example/SubscriptionForm.java
  
  Index: SubscriptionForm.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/example/org/apache/struts/webapp/example/SubscriptionForm.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SubscriptionForm.java 11 Jan 2003 03:08:23 -  1.4
  +++ SubscriptionForm.java 16 Aug 2003 18:29:09 -  1.5
  @@ -7,7 +7,7 @@
*
* The Apache Software License, Version 1.1
*
  - * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
  @@ -64,10 +64,11 @@
   
   
   import javax.servlet.http.HttpServletRequest;
  -import org.apache.struts.action.ActionError;
  +
   import org.apache.struts.action.ActionErrors;
   import org.apache.struts.action.ActionForm;
   import org.apache.struts.action.ActionMapping;
  +import org.apache.struts.action.ActionMessage;
   
   
   /**
  @@ -301,19 +302,19 @@
   
if ((host == null) || (host.length() < 1))
   errors.add("host",
  -   new ActionError("error.host.required"));
  +   new ActionMessage("error.host.required"));
if ((username == null) || (username.length() < 1))
   errors.add("username",
  -   new ActionError("error.username.required"));
  +   new ActionMessage("error.username.required"));
if ((password == null) || (password.length() < 1))
   errors.add("password",
  -   new ActionError("error.password.required"));
  +   new ActionMessage("error.password.required"));
if ((type == null) || (type.length() < 1))
   errors.add("type",
  -   new ActionError("error.type.required"));
  +   new ActionMessage("error.type.required"));
else if (!"imap".equals(type) && !"pop3".equals(type))
   errors.add("type",
  -   new ActionError("error.type.invalid", type));
  +   new ActionMessage("error.type.invalid", type));
   
return (errors);
   
  
  
  
  1.14  +70 -78
jakarta-struts/src/example/org/apache/struts/webapp/example/SaveSubscriptionAction.java
  
  Index: SaveSubscriptionAction.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/example/org/apache/struts/webapp/example/SaveSubscriptionAction.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- SaveSubscriptionAction.java   18 Jan 2003 19:48:56 -  1.13
  +++ SaveSubscriptionAction.java   16 Aug 2003 18:29:09 -  1.14
  @@ -7,7 +7,7 @@
*
* The Apache Software License, Version 1.1
*
  - * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
  @@ -59,16 +59,15 @@
*
*/
   
  -
   package org.apache.struts.webapp.example;
   
  -
   import java.lang.reflect.InvocationTargetException;
  -import java.util.Locale;
  +
   import javax.servlet.ServletException;
   import javax.servlet.http.HttpServletRequest;
  -import javax.servlet.http.HttpSession;
   import javax.servlet.http.HttpServletResponse;
  +import javax.servlet.http.HttpSession;
  +
   import org.apache.commons.beanutils.PropertyUtils;
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  @@ -78,7 +77,6 @@
   import org.apache.struts.action.ActionMapping;
   import org.apache.struts.util.MessageResources;
   
  -
   /**
* Implementation of Action that validates and creates or
* updates the mail subscription entered by the user.
  @@ -89,20 +87,15 @@
   
   public final class SaveSubscriptionAction extends Action {
   
  -
   // - Instance Variables
   
  -
   /**
* The Log instance for this application.
*/
  -private Log log =
  -LogFactory.getLog("org.apache.struts.webapp.Example");
  -
  +private 

cvs commit: jakarta-struts/src/tiles-documentation/org/apache/struts/webapp/tiles/portal UserPortalSettingsAction.java UserPortalAction.java

2003-08-16 Thread dgraham
dgraham 2003/08/16 11:21:31

  Modified:src/tiles-documentation/org/apache/struts/webapp/tiles/portal
UserPortalSettingsAction.java UserPortalAction.java
  Log:
  Formatting, bad imports.
  
  Revision  ChangesPath
  1.4   +35 -48
jakarta-struts/src/tiles-documentation/org/apache/struts/webapp/tiles/portal/UserPortalSettingsAction.java
  
  Index: UserPortalSettingsAction.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/tiles-documentation/org/apache/struts/webapp/tiles/portal/UserPortalSettingsAction.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- UserPortalSettingsAction.java 21 Jul 2003 15:18:46 -  1.3
  +++ UserPortalSettingsAction.java 16 Aug 2003 18:21:31 -  1.4
  @@ -7,7 +7,7 @@
*
* The Apache Software License, Version 1.1
*
  - * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
  @@ -61,9 +61,6 @@
   
   package org.apache.struts.webapp.tiles.portal;
   
  -import java.io.IOException;
  -
  -import javax.servlet.ServletException;
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;
   
  @@ -73,7 +70,6 @@
   import org.apache.struts.tiles.ComponentContext;
   import org.apache.struts.tiles.actions.TilesAction;
   
  -
   /**
* Implementation of Action that populates an instance of
* SubscriptionForm from the currently specified subscription.
  @@ -90,13 +86,8 @@
* @author Cedric Dumoulin
* @version $Revision$ $Date$
*/
  -
   public final class UserPortalSettingsAction extends TilesAction {
   
  -
  -// - Public Methods
  -
  -
   /**
* Process the specified HTTP request, and create the corresponding HTTP
* response (or forward to another web component that will create it).
  @@ -120,42 +111,38 @@
   ActionForm form,
   HttpServletRequest request,
   HttpServletResponse response)
  -throws Exception
  -  {
  -  //System.out.println("Enter action UserPortalSettingsAction");
  -  PortalSettingsForm prefsForm = (PortalSettingsForm)form;
  -
  -  // Get user portal settings from user context
  -  PortalSettings settings = UserPortalAction.getSettings( request, context);
  -  PortalCatalog catalog = UserPortalAction.getPortalCatalog( context, 
getServlet().getServletContext() );
  -
  -  if( prefsForm.isSubmitted() )
  -{  // read arrays
  -//System.out.println("form submitted");
  -
  -  // Set settings cols according to user choice
  -for( int i=0;i

cvs commit: jakarta-struts/src/tiles-documentation/org/apache/struts/webapp/tiles/portal UserMenuAction.java

2003-08-16 Thread dgraham
dgraham 2003/08/16 11:20:08

  Modified:src/tiles-documentation/org/apache/struts/webapp/tiles/portal
UserMenuAction.java
  Log:
  Formatted and replaced hardcoded debugging with commons logging.
  
  Revision  ChangesPath
  1.4   +204 -161  
jakarta-struts/src/tiles-documentation/org/apache/struts/webapp/tiles/portal/UserMenuAction.java
  
  Index: UserMenuAction.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/tiles-documentation/org/apache/struts/webapp/tiles/portal/UserMenuAction.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- UserMenuAction.java   21 Jul 2003 15:18:46 -  1.3
  +++ UserMenuAction.java   16 Aug 2003 18:20:08 -  1.4
  @@ -7,7 +7,7 @@
*
* The Apache Software License, Version 1.1
*
  - * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
  @@ -72,6 +72,8 @@
   import javax.servlet.http.HttpServletResponse;
   import javax.servlet.http.HttpSession;
   
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
   import org.apache.struts.action.ActionForm;
   import org.apache.struts.action.ActionForward;
   import org.apache.struts.action.ActionMapping;
  @@ -82,7 +84,6 @@
   import org.apache.struts.tiles.actions.TilesAction;
   import org.apache.struts.tiles.beans.MenuItem;
   
  -
   /**
* This controller load user menu settings and put them in tile context.
* If menu settings are not defined for user, defined them based on tiles
  @@ -110,25 +111,46 @@
* @author Cedric Dumoulin
* @version $Revision$ $Date$
*/
  -
   public final class UserMenuAction extends TilesAction implements Controller {
   
  -  /** debug flag */
  -public static boolean debug = false;
  +/** 
  + * Commons Logging instance.
  + */
  +private static Log log = LogFactory.getLog(UserMenuAction.class);
   
  -  /** Tile attribute containing name used to store user settings in session 
context */
  +/** 
  + * Tile attribute containing name used to store user settings in session 
  + * context.
  + */
   public static String USER_SETTINGS_NAME_ATTRIBUTE = "userSettingsName";
  -  /** Default name used to store settings in session context */
  -public static String DEFAULT_USER_SETTINGS_NAME = 
"tiles.examples.portal.USER_MENU_SETTINGS";
   
  -  /** Default name used to store menu catalog in application scope */
  -public static String DEFAULT_MENU_CATALOG_NAME = 
"tiles.examples.portal.MenuCatalog";
  -  /** Tile attribute containing name used to store menu catalog in application 
scope */
  +/** 
  + * Default name used to store settings in session context. 
  + */
  +public static String DEFAULT_USER_SETTINGS_NAME =
  +"tiles.examples.portal.USER_MENU_SETTINGS";
  +
  +/** 
  + * Default name used to store menu catalog in application scope.
  + */
  +public static String DEFAULT_MENU_CATALOG_NAME =
  +"tiles.examples.portal.MenuCatalog";
  +
  +/** 
  + * Tile attribute containing name used to store menu catalog in application 
  + * scope.
  + */
   public static String MENU_CATALOG_NAME_ATTRIBUTE = "catalogName";
  -  /** Tile attribute containing name of the settings definition used to 
initialize catalog */
  +
  +/** 
  + * Tile attribute containing name of the settings definition used to 
  + * initialize catalog. 
  + */
   public static final String CATALOG_SETTING_ATTRIBUTE = "catalogSettings";
   
  -  /** Tile attribute containing items to render   */
  +/** 
  + * Tile attribute containing items to render.
  + */
   public static String USER_ITEMS_ATTRIBUTE = "items";
   
   /**
  @@ -155,37 +177,37 @@
   ActionForm form,
   HttpServletRequest request,
   HttpServletResponse response)
  -throws Exception
  -{
  -perform( context, request, response, getServlet().getServletContext() );
  -   return null; //(mapping.findForward("success"));
  +throws Exception {
  +
  +perform(context, request, response, getServlet().getServletContext());
  +return null; //(mapping.findForward("success"));
   }
   
  -   /**
  -* Method associated to a tile and called immediately before tile is included.
  -* @param tileContext Current tile context.
  -* @param request Current request
  -* @param response Current response
  -* @param servletContext Current servlet context
  -*/
  -   public void perform(ComponentContext context,
  -   HttpServletRequest request, HttpServletResponse response,
  -

cvs commit: jakarta-struts/src/tiles-documentation/org/apache/struts/webapp/tiles/portal UserMenuSettingsAction.java

2003-08-16 Thread dgraham
dgraham 2003/08/16 11:15:17

  Modified:src/tiles-documentation/org/apache/struts/webapp/tiles/portal
UserMenuSettingsAction.java
  Log:
  Formatted and replaced hardcoded debugging with commons logging.
  
  Revision  ChangesPath
  1.4   +107 -105  
jakarta-struts/src/tiles-documentation/org/apache/struts/webapp/tiles/portal/UserMenuSettingsAction.java
  
  Index: UserMenuSettingsAction.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/tiles-documentation/org/apache/struts/webapp/tiles/portal/UserMenuSettingsAction.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- UserMenuSettingsAction.java   21 Jul 2003 15:18:46 -  1.3
  +++ UserMenuSettingsAction.java   16 Aug 2003 18:15:17 -  1.4
  @@ -7,7 +7,7 @@
*
* The Apache Software License, Version 1.1
*
  - * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
  @@ -61,15 +61,15 @@
   
   package org.apache.struts.webapp.tiles.portal;
   
  -import java.io.IOException;
   import java.util.ArrayList;
   import java.util.Iterator;
   import java.util.List;
   
  -import javax.servlet.ServletException;
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;
   
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
   import org.apache.struts.action.ActionForm;
   import org.apache.struts.action.ActionForward;
   import org.apache.struts.action.ActionMapping;
  @@ -77,23 +77,23 @@
   import org.apache.struts.tiles.actions.TilesAction;
   import org.apache.struts.tiles.beans.MenuItem;
   
  -  /**
  -   * Tiles controller as Struts Action.
  -   * This controller take a list of lists of MenuItems, and arrange them
  -   * to be shown by appropriate jsp view.
  -   * Create and set following attribute in Tile context :
  -   * 
  -   *   names : list of names to display
  -   *   returnedValues : list of corresponding key, or values to return
  -   *   selecteds : list of boolean indicating whether or not a name is 
selected
  -   * 
  +/**
  + * Tiles controller as Struts Action.
  + * This controller take a list of lists of MenuItems, and arrange them
  + * to be shown by appropriate jsp view.
  + * Create and set following attribute in Tile context :
  + * 
  + *   names : list of names to display
  + *   returnedValues : list of corresponding key, or values to return
  + *   selecteds : list of boolean indicating whether or not a name is 
selected
  + * 
* Tiles input attributes :
* 
*   title : menu title
*   items : Menu entries used as default when user settings is created
*   defaultChoice : Menus or menu entries porposed as choice to user
*   storeUnderName : Store user settings under provided name in session 
context [optional]
  - *   
  + *  
* 
* Tiles output attributes :
* 
  @@ -101,107 +101,109 @@
*   userItems : List of user actual menu items
* 
*
  -   */
  -public class UserMenuSettingsAction extends TilesAction
  -{
  -  /** debug flag */
  -public static boolean debug = false;
  -
  -  /**
  - * Process the specified HTTP request, and create the corresponding HTTP
  - * response (or forward to another web component that will create it).
  - * Return an ActionForward instance describing where and how
  - * control should be forwarded, or null if the response has
  - * already been completed.
  - *
  - * @param context The current Tile context, containing Tile attributes.
  - * @param mapping The ActionMapping used to select this instance.
  - * @param form The optional ActionForm bean for this request (if any).
  - * @param request The HTTP request we are processing.
  - * @param response The HTTP response we are creating.
  - *
  - * @exception Exception if the application business logic throws
  - *  an exception
  - * @since Struts 1.1
  + */
  +public class UserMenuSettingsAction extends TilesAction {
  +
  +/** 
  + * Commons Logging instance.
*/
  +private static Log log = LogFactory.getLog(UserMenuSettingsAction.class);
  +
  +/**
  +* Process the specified HTTP request, and create the corresponding HTTP
  +* response (or forward to another web component that will create it).
  +* Return an ActionForward instance describing where and how
  +* control should be forwarded, or null if the response has
  +* already been completed.
  +*
  +* @param context The current Tile context, containing Tile attributes.
  +* @param mapping The ActionMapping used to select this instance.
  +* @param form The optional ActionForm bean for this re

Re: parameter vs. set-property (was Re: Flexible form support)

2003-08-16 Thread Robert Leland
Sgarlata Matt wrote:

Ted Husted wrote:

IMHO, the "general purpose" parameter has been a useful feature of 
ActionConfig/ActionMapping and is worth applying elsewhere. We just 
have to be quick to remind people that if they outgrow the general 
purpose parameter, then they should start extending the base object 
and using set-property. (As people often do now.)


I agree;  is my favorite Struts extension point :) 
However, I would like to point out that it doesn't work very well for 
the  element.  The reason for this is that 
 populates a MessageResourcesConfig object instead of 
the actual MessageResources object.  Then in the ActionServlet, when 
the MessageResources object is initialized it is passed the 
"parameter" information but is not passed any  information:

// here the resources are created, and passed the parameter
MessageResources resources =
factoryObject.createResources(mrcs[i].getParameter());
// here the resources are passed the return null info
resources.setReturnNull(mrcs[i].getNull());
//!! here I think we should pass the MessageResourcesConfig
getServletContext().setAttribute(
mrcs[i].getKey() + config.getPrefix(),
resources);
What do you think?  Would this be a reasonable enhancement request?  
Can I post it in BugZilla with patches? 
Since you have talked about it on the struts-user group, and it looks 
like the existing system makes your
life harder, then open a Bugzilla request. What ever committer looks at 
the bug request will determine if the patch will be applied or modified.
[Patches] are always welcome and speed the process ! If possible patch 
against the current HEAD of struts source
code. Use the diff -u old new. I also like to use 'diff -u 5 old new' 
just to be sure.

-Rob

--
Robert Leland   [EMAIL PROTECTED]
--
Java, J2EE, Struts, Web Application Development
804 N. Kenmore Street   +01-703-525-3580
Arlington VA 22201


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


cvs commit: jakarta-struts/src/tiles-documentation/org/apache/struts/webapp/tiles/rssChannel RssChannelsAction.java Channels.java

2003-08-16 Thread dgraham
dgraham 2003/08/16 11:07:41

  Modified:src/tiles-documentation/org/apache/struts/webapp/tiles/rssChannel
RssChannelsAction.java Channels.java
  Log:
  Replaced ActionError with ActionMessage.
  
  Revision  ChangesPath
  1.6   +7 -6  
jakarta-struts/src/tiles-documentation/org/apache/struts/webapp/tiles/rssChannel/RssChannelsAction.java
  
  Index: RssChannelsAction.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/tiles-documentation/org/apache/struts/webapp/tiles/rssChannel/RssChannelsAction.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- RssChannelsAction.java16 Aug 2003 18:04:41 -  1.5
  +++ RssChannelsAction.java16 Aug 2003 18:07:41 -  1.6
  @@ -71,11 +71,11 @@
   import org.apache.commons.digester.rss.RSSDigester;
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  -import org.apache.struts.action.ActionError;
   import org.apache.struts.action.ActionErrors;
   import org.apache.struts.action.ActionForm;
   import org.apache.struts.action.ActionForward;
   import org.apache.struts.action.ActionMapping;
  +import org.apache.struts.action.ActionMessage;
   import org.apache.struts.tiles.ComponentContext;
   import org.apache.struts.tiles.actions.TilesAction;
   
  @@ -177,7 +177,8 @@
   } catch (Throwable t) {
   errors.add(
   ActionErrors.GLOBAL_ERROR,
  -new ActionError("rss.access.error"));
  +new ActionMessage("rss.access.error"));
  +
   servlet.log(t.toString());
   }
   
  
  
  
  1.6   +5 -7  
jakarta-struts/src/tiles-documentation/org/apache/struts/webapp/tiles/rssChannel/Channels.java
  
  Index: Channels.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/tiles-documentation/org/apache/struts/webapp/tiles/rssChannel/Channels.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Channels.java 16 Aug 2003 17:59:34 -  1.5
  +++ Channels.java 16 Aug 2003 18:07:41 -  1.6
  @@ -61,7 +61,6 @@
   
   package org.apache.struts.webapp.tiles.rssChannel;
   
  -import java.io.IOException;
   import java.util.ArrayList;
   import java.util.List;
   
  @@ -74,11 +73,11 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   import org.apache.struts.action.Action;
  -import org.apache.struts.action.ActionError;
   import org.apache.struts.action.ActionErrors;
   import org.apache.struts.action.ActionForm;
   import org.apache.struts.action.ActionForward;
   import org.apache.struts.action.ActionMapping;
  +import org.apache.struts.action.ActionMessage;
   import org.apache.struts.tiles.ComponentContext;
   
   /**
  @@ -116,12 +115,12 @@
   /**
* Main process of class. Reads, parses
*/
  -public ActionForward perform(
  +public ActionForward execute(
   ActionMapping mapping,
   ActionForm form,
   HttpServletRequest request,
   HttpServletResponse response)
  -throws IOException, ServletException {
  +throws Exception {
   
   log.debug("Enter Rss Channel Action");
   
  @@ -132,7 +131,6 @@
   }
   
   ActionErrors errors = new ActionErrors();
  -org.apache.commons.digester.rss.Channel channel = null;
   
   // -- Retrieve parameters --
   // Urls can come from a list, or from a single attribute.
  @@ -168,7 +166,7 @@
   } catch (Throwable t) {
   errors.add(
   ActionErrors.GLOBAL_ERROR,
  -new ActionError("rss.access.error"));
  +new ActionMessage("rss.access.error"));
   
   servlet.log(t.toString());
   }
  @@ -194,7 +192,7 @@
   
   // Use Tile context to pass channels
   context.putAttribute(CHANNELS_KEY, channelBeans);
  -
  +
   return mapping.findForward("continue");
   }
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Flexible form support (was Re: Simplifying DynaActionForms)

2003-08-16 Thread Craig R. McClanahan
On Sat, 16 Aug 2003, Ted Husted wrote:

> Date: Sat, 16 Aug 2003 07:00:52 -0400
> From: Ted Husted <[EMAIL PROTECTED]>
> Reply-To: Struts Developers List <[EMAIL PROTECTED]>
> To: Struts Developers List <[EMAIL PROTECTED]>
> Subject: Re: Flexible form support (was Re: Simplifying DynaActionForms)
>
> Steve Raeburn wrote:
> > The problem with adding a 'parameter' is that you then find a need for
> > another parameter, etc etc. Is  not suitable here? Or, even
> > better, nested configuration elements under form-bean.
>
> Yes, set-property would work here, just like everywhere else. I'm just
> saying that if action has a general-purpose "parameter", then maybe
> form-bean and forward should have one too. People would not then have to
> extend action-forward or form-bean every time they wanted to try
> something out.
>
> IMHO, the "general purpose" parameter has been a useful feature of
> ActionConfig/ActionMapping and is worth applying elsewhere. We just have
> to be quick to remind people that if they outgrow the general purpose
> parameter, then they should start extending the base object and using
> set-property. (As people often do now.)
>

+1

> -Ted.
>
>

Craig

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-struts/src/tiles-documentation/org/apache/struts/webapp/tiles/rssChannel RssChannelsAction.java

2003-08-16 Thread dgraham
dgraham 2003/08/16 11:04:41

  Modified:src/tiles-documentation/org/apache/struts/webapp/tiles/rssChannel
RssChannelsAction.java
  Log:
  Formatted and replaced hardcoded debugging with commons logging.
  
  Revision  ChangesPath
  1.5   +62 -125   
jakarta-struts/src/tiles-documentation/org/apache/struts/webapp/tiles/rssChannel/RssChannelsAction.java
  
  Index: RssChannelsAction.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/tiles-documentation/org/apache/struts/webapp/tiles/rssChannel/RssChannelsAction.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- RssChannelsAction.java21 Jul 2003 15:18:47 -  1.4
  +++ RssChannelsAction.java16 Aug 2003 18:04:41 -  1.5
  @@ -7,7 +7,7 @@
*
* The Apache Software License, Version 1.1
*
  - * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
  @@ -61,16 +61,16 @@
   
   package org.apache.struts.webapp.tiles.rssChannel;
   
  -import java.io.IOException;
   import java.util.ArrayList;
   import java.util.List;
   
  -import javax.servlet.ServletException;
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;
   
   import org.apache.commons.digester.rss.Channel;
   import org.apache.commons.digester.rss.RSSDigester;
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
   import org.apache.struts.action.ActionError;
   import org.apache.struts.action.ActionErrors;
   import org.apache.struts.action.ActionForm;
  @@ -99,25 +99,26 @@
*/
   public final class RssChannelsAction extends TilesAction {
   
  +/** 
  + * Commons Logging instance.
  + */
  +private static Log log = LogFactory.getLog(RssChannelsAction.class);
   
  -  /** Debug flag */
  -public static final boolean debug = true;
   /**
* Tile attribute key for saving Channel bean
*/
   public static final String CHANNELS_KEY = "CHANNELS";
  +
   /**
* Tile attribute key for getting Channel urls list
*/
   public static final String CHANNEL_URLS_KEY = "urls";
  +
   /**
* Tile attribute key for getting Channel url attribute
*/
   public static final String CHANNEL_URL_KEY = "url";
   
  -// - Instances Variables
  -// - Public Methods
  -
   /**
* Main process of class. Reads, parses
* @param context The current Tile context, containing Tile attributes.
  @@ -136,53 +137,46 @@
   ActionForm form,
   HttpServletRequest request,
   HttpServletResponse response)
  -throws Exception
  -{
  -//System.out.println("Enter action UserPortalAction");
  -if(debug)
  -  System.out.println( "Enter Rss Channel Action" );
  +throws Exception {
   
  +log.debug("Enter Rss Channel Action");
   
   ActionErrors errors = new ActionErrors();
  -org.apache.commons.digester.rss.Channel channel = null;
   
   // -- Retrieve parameters --
   // Urls can come from a list, or from a single attribute.
   
  -List channels = (List)context.getAttribute( CHANNEL_URLS_KEY );
  -if( channels == null )
  -  {
  -  Object url = context.getAttribute( CHANNEL_URL_KEY );
  -  channels = new ArrayList(1);
  -  channels.add(url);
  -  }
  -//channels.add("http://www.newsforge.com/newsforge.rss";);
  -//channels.add("http://xmlhack.com/rss.php";);
  -//channels.add("http://lwn.net/headlines/rss";);
  -// channels.trimToSize();
  +List channels = (List) context.getAttribute(CHANNEL_URLS_KEY);
  +if (channels == null) {
  +Object url = context.getAttribute(CHANNEL_URL_KEY);
  +channels = new ArrayList(1);
  +channels.add(url);
  +}
  +
  +log.debug("urls count" + channels.size());
   
  -if(debug)
  -  System.out.println( "urls count" + channels.size() ) ;
   // -- Loop through channels --
   List channelBeans = new ArrayList(channels.size());
   try {
  -for (int i=0; ihttp://www.apache.org/)."
  - *Alternately, this acknowlegement may appear in the software itself,
  - *if and wherever such third-party acknowlegements normally appear.
  - *
  - * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
  - *Foundation" must not be used to endorse or promote products derived
  - *from this software without prior written permission. For writ

cvs commit: jakarta-struts/src/tiles-documentation/org/apache/struts/webapp/tiles/rssChannel Channels.java

2003-08-16 Thread dgraham
dgraham 2003/08/16 10:59:34

  Modified:src/tiles-documentation/org/apache/struts/webapp/tiles/rssChannel
Channels.java
  Log:
  Formatted and replaced hardcoded debugging with commons logging.
  
  Revision  ChangesPath
  1.5   +73 -73
jakarta-struts/src/tiles-documentation/org/apache/struts/webapp/tiles/rssChannel/Channels.java
  
  Index: Channels.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/tiles-documentation/org/apache/struts/webapp/tiles/rssChannel/Channels.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Channels.java 4 May 2003 22:41:12 -   1.4
  +++ Channels.java 16 Aug 2003 17:59:34 -  1.5
  @@ -7,7 +7,7 @@
*
* The Apache Software License, Version 1.1
*
  - * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
  @@ -93,45 +93,43 @@
*/
   public final class Channels extends Action {
   
  +/** 
  + * Commons Logging instance.
  + */
  +private static Log log = LogFactory.getLog(Channels.class);
   
  -   /** Commons Logging instance.*/
  -protected static Log log = LogFactory.getLog(Channels.class);
  -  /** Debug flag */
  -public static final boolean debug = true;
   /**
* Tile attribute key for saving Channel bean
*/
   public static final String CHANNELS_KEY = "CHANNELS";
  +
   /**
* Tile attribute key for getting Channel urls list
*/
   public static final String CHANNEL_URLS_KEY = "urls";
  +
   /**
* Tile attribute key for getting Channel url attribute
*/
   public static final String CHANNEL_URL_KEY = "url";
   
  -// - Instances Variables
  -// - Public Methods
  -
   /**
* Main process of class. Reads, parses
*/
  -public ActionForward perform(ActionMapping mapping,
  - ActionForm form,
  - HttpServletRequest request,
  - HttpServletResponse response)
  +public ActionForward perform(
  +ActionMapping mapping,
  +ActionForm form,
  +HttpServletRequest request,
  +HttpServletResponse response)
   throws IOException, ServletException {
   
  -if(debug)
  -  System.out.println( "Enter Rss Channel Action" );
  +log.debug("Enter Rss Channel Action");
   
  -  // Try to retrieve tile context
  -ComponentContext context = ComponentContext.getContext( request );
  -if( context == null )
  -  {
  -  throw new ServletException( "This action must be called by a Tile, not 
directly" );
  -  }
  +// Try to retrieve tile context
  +ComponentContext context = ComponentContext.getContext(request);
  +if (context == null) {
  +throw new ServletException("This action must be called by a Tile, not 
directly");
  +}
   
   ActionErrors errors = new ActionErrors();
   org.apache.commons.digester.rss.Channel channel = null;
  @@ -139,78 +137,80 @@
   // -- Retrieve parameters --
   // Urls can come from a list, or from a single attribute.
   
  -List channels = (List)context.getAttribute( CHANNEL_URLS_KEY );
  -if( channels == null )
  -  {
  -  Object url = context.getAttribute( CHANNEL_URL_KEY );
  -  channels = new ArrayList(1);
  -  channels.add(url);
  -  }
  -//channels.add("http://www.newsforge.com/newsforge.rss";);
  -//channels.add("http://xmlhack.com/rss.php";);
  -//channels.add("http://lwn.net/headlines/rss";);
  -// channels.trimToSize();
  +List channels = (List) context.getAttribute(CHANNEL_URLS_KEY);
  +if (channels == null) {
  +Object url = context.getAttribute(CHANNEL_URL_KEY);
  +channels = new ArrayList(1);
  +channels.add(url);
  +}
  +
  +log.debug("urls count" + channels.size());
   
  -if(debug)
  -  System.out.println( "urls count" + channels.size() ) ;
   // -- Loop through channels --
   ArrayList channelBeans = new ArrayList(channels.size());
   try {
  -for (int i=0; i

cvs commit: jakarta-struts/src/share/org/apache/struts/action ExceptionHandler.java

2003-08-16 Thread dgraham
dgraham 2003/08/16 10:50:10

  Modified:src/share/org/apache/struts/action ExceptionHandler.java
  Log:
  Added storeException() method that takes an ActionMessage instead of
  ActionError.
  
  Revision  ChangesPath
  1.21  +38 -10
jakarta-struts/src/share/org/apache/struts/action/ExceptionHandler.java
  
  Index: ExceptionHandler.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/action/ExceptionHandler.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- ExceptionHandler.java 7 Aug 2003 00:39:05 -   1.20
  +++ ExceptionHandler.java 16 Aug 2003 17:50:10 -  1.21
  @@ -168,17 +168,45 @@
* @param error - The error generated from the exception mapping
* @param forward - The forward generated from the input path (from the form or 
exception mapping)
* @param scope - The scope of the exception mapping.
  + * @deprecated Use storeException(HttpServletRequest, String, ActionMessage, 
ActionForward, String)
  + * instead.  This will be removed after Struts 1.2.
*/
  -protected void storeException(HttpServletRequest request,
  -String property,
  -ActionError error,
  -ActionForward forward,
  -String scope) {
  -
  +protected void storeException(
  +HttpServletRequest request,
  +String property,
  +ActionError error,
  +ActionForward forward,
  +String scope) {
  +
  +this.storeException(request, property, error, forward, scope);
  +}
  +
  +/**
  + * Default implementation for handling an ActionMessage generated
  + * from an Exception during Action delegation.  The default
  + * implementation is to set an attribute of the request or session, as
  + * defined by the scope provided (the scope from the exception mapping).  An
  + * ActionErrors instance is created, the error is added to the 
  + * collection and the collection is set under the Globals.ERROR_KEY.
  + *
  + * @param request - The request we are handling
  + * @param property  - The property name to use for this error
  + * @param error - The error generated from the exception mapping
  + * @param forward - The forward generated from the input path (from the form or 
exception mapping)
  + * @param scope - The scope of the exception mapping.
  + * @since Struts 1.2
  + */
  +protected void storeException(
  +HttpServletRequest request,
  +String property,
  +ActionMessage error,
  +ActionForward forward,
  +String scope) {
  +
   ActionErrors errors = new ActionErrors();
   errors.add(property, error);
   
  -if ("request".equals(scope)){
  +if ("request".equals(scope)) {
   request.setAttribute(Globals.ERROR_KEY, errors);
   } else {
   request.getSession().setAttribute(Globals.ERROR_KEY, errors);
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-struts/src/share/org/apache/struts/taglib/html ErrorsTag.java

2003-08-16 Thread dgraham
dgraham 2003/08/16 10:39:11

  Modified:src/share/org/apache/struts/taglib/html ErrorsTag.java
  Log:
  Replace ActionError with ActionMessage.
  
  Revision  ChangesPath
  1.28  +9 -9  
jakarta-struts/src/share/org/apache/struts/taglib/html/ErrorsTag.java
  
  Index: ErrorsTag.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/ErrorsTag.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- ErrorsTag.java31 Jul 2003 00:25:39 -  1.27
  +++ ErrorsTag.java16 Aug 2003 17:39:11 -  1.28
  @@ -68,8 +68,8 @@
   import javax.servlet.jsp.tagext.TagSupport;
   
   import org.apache.struts.Globals;
  -import org.apache.struts.action.ActionError;
   import org.apache.struts.action.ActionErrors;
  +import org.apache.struts.action.ActionMessage;
   import org.apache.struts.taglib.TagUtils;
   import org.apache.struts.util.MessageResources;
   
  @@ -197,13 +197,13 @@
   TagUtils.getInstance().present(pageContext, bundle, locale, 
"errors.header");
   
   boolean footerPresent =
  -TagUtils.getInstance().present(pageContext, bundle, locale, 
"errors.footer");
  +TagUtils.getInstance().present(pageContext, bundle, locale, 
"errors.footer");
   
   boolean prefixPresent =
  -TagUtils.getInstance().present(pageContext, bundle, locale, 
"errors.prefix");
  +TagUtils.getInstance().present(pageContext, bundle, locale, 
"errors.prefix");
   
   boolean suffixPresent =
  -TagUtils.getInstance().present(pageContext, bundle, locale, 
"errors.suffix");
  +TagUtils.getInstance().present(pageContext, bundle, locale, 
"errors.suffix");
   
   // Render the error messages appropriately
   StringBuffer results = new StringBuffer();
  @@ -212,7 +212,7 @@
   Iterator reports = (property == null) ? errors.get() : errors.get(property);
   
   while (reports.hasNext()) {
  -ActionError report = (ActionError) reports.next();
  +ActionMessage report = (ActionMessage) reports.next();
   if (!headerDone) {
   if (headerPresent) {
   message =
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



parameter vs. set-property (was Re: Flexible form support)

2003-08-16 Thread Sgarlata Matt
Ted Husted wrote:
IMHO, the "general purpose" parameter has been a useful feature of 
ActionConfig/ActionMapping and is worth applying elsewhere. We just have 
to be quick to remind people that if they outgrow the general purpose 
parameter, then they should start extending the base object and using 
set-property. (As people often do now.)
I agree;  is my favorite Struts extension point :) 
However, I would like to point out that it doesn't work very well for 
the  element.  The reason for this is that 
 populates a MessageResourcesConfig object instead of the 
actual MessageResources object.  Then in the ActionServlet, when the 
MessageResources object is initialized it is passed the "parameter" 
information but is not passed any  information:

// here the resources are created, and passed the parameter
MessageResources resources =
factoryObject.createResources(mrcs[i].getParameter());
// here the resources are passed the return null info
resources.setReturnNull(mrcs[i].getNull());
//!! here I think we should pass the MessageResourcesConfig
getServletContext().setAttribute(
mrcs[i].getKey() + config.getPrefix(),
resources);
What do you think?  Would this be a reasonable enhancement request?  Can 
I post it in BugZilla with patches?

-Ted.
Matt

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Decomposing RequestProcessor -- Some Code To Play With

2003-08-16 Thread Leonardo Quijano Vincenzi
Tom Drake wrote:

I've condensed the UnaryPredicate interface here. It provides both a boolean
return and a context parameter.
package org.apache.commons.functor;

public interface UnaryPredicate {
   boolean test(Object obj);
	
}
 

Commons-collections already has a Predicate interface, btw:

   org.apache.commons.collections.Predicate

 |boolean| |*evaluate 
*(Object 
 input)| 

Leonardo

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Flexible form support (was Re: Simplifying DynaActionForms)

2003-08-16 Thread Ted Husted
Steve Raeburn wrote:
The problem with adding a 'parameter' is that you then find a need for
another parameter, etc etc. Is  not suitable here? Or, even
better, nested configuration elements under form-bean.
Yes, set-property would work here, just like everywhere else. I'm just 
saying that if action has a general-purpose "parameter", then maybe 
form-bean and forward should have one too. People would not then have to 
extend action-forward or form-bean every time they wanted to try 
something out.

IMHO, the "general purpose" parameter has been a useful feature of 
ActionConfig/ActionMapping and is worth applying elsewhere. We just have 
to be quick to remind people that if they outgrow the general purpose 
parameter, then they should start extending the base object and using 
set-property. (As people often do now.)

-Ted.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]