You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Christophe Thiebaud <ct...@stylo.it> on 2000/10/09 19:29:37 UTC

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

Re: error with parameters

Posted by Martin Cooper <ma...@tumbleweed.com>.
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" <ct...@stylo.it>
To: <st...@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