struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Proetel, Ingo" <iproe...@SELECTICA.com>
Subject RE: error with parameters
Date Tue, 10 Oct 2000 17:10:54 GMT
I have not seen the earlier discussion, so if this is old stuff just ignore
it.

I suggest to add a new function to add a new method to ErrorMessages:

 
  public void addError(String key,Object[] args) 

	
 the ErrorTag class needs then to be adjusted to query for the arguments and
use the with the correct error key.

And in the Action class the saveErrors() method need to be adjusted to store
the ErrorMessages object instead of the String[].

This change to the code seems quite simple and it is as easy to use as the
current mechanism.

ingo

> -----Original Message-----
> From: Martin Cooper [mailto:martin.cooper@tumbleweed.com]
> Sent: Monday, October 09, 2000 8:28 PM
> To: struts-user@jakarta.apache.org
> Subject: Re: error with parameters
> 
> 
> I suggested a simple change to enable this a few weeks ago. 
> Unfortunately
> (in my opinion), the discussion got a little carried away 
> with inventing
> quite sophisticated error reporting mechanisms.
> 
> What I had suggested was adding an errors.format value in 
> addition to the
> existing errors.header and errors.footer values. I'll admit 
> that this is not
> nearly as flexible as some of the other suggestions made, but 
> it would be a
> very simple addition to the existing <struts:errors> tag that 
> wouldn't break
> any existing code.
> 
> --
> Martin Cooper
> Tumbleweed Communications
> 
> ----- Original Message -----
> From: "Christophe Thiebaud" <cthiebaud@stylo.it>
> To: <struts-user@jakarta.apache.org>
> Sent: Monday, October 09, 2000 10:29 AM
> Subject: error with parameters
> 
> 
> Is there a way to use parameterized errors with struts ?
> 
> in the example application the file ApplicationResources.properties
> has several string with a {0] tag,
> (e.g. linkSubscription.noSubscription=No subscription under 
> attribute {0}
> 
> but these strings are used only to throw  JspException 
> objects, like in:
> 
> // Print this element to our output writer
> JspWriter writer = pageContext.getOut();
> try {
>     writer.print(results.toString());
> } catch (IOException e) {
>     throw new JspException
> (messages.getMessage("linkSubscription.io", e.toString()));
> }
> 
> there is no way currently to have the struts tag ErrorsTag handle
> parameterized
> errors.
> 
> how do struts users manage that ?
> 
> Christophe
> 
> 

Mime
View raw message