You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Heligon Sandra <sa...@nextream.fr> on 2002/10/11 11:23:58 UTC
Error messages and ApplicationResources file
I have a question about the location of the error messages.
I don't use servlet engine authentication, I must make a connection
to
an back-end server that does authentication.
The server can return exceptions because userName or password are
not correct.
For example in my LoginAction:
try{
server.login(userName, pwd);
}
catch (ExInvalidLoginNameOrPassword ex)
{
errors.add(ActionErrors.GLOBAL_ERROR,
new ActionError("error.password.mismatch"));
}
if ( !errors.empty() )
{
saveErrors(request, errors);
return (new ActionForward(mapping.getInput()));
}
I would like to know if the message associated to the
ExInvalidLoginNameOrPassword
and identified by the key error.password.mismatch has to be
necessary in the
ApplicationResources.properties.
Several error messages are common to multiple applications (not
necessarily Web, but
JAVA applications).
The file that defines the messages must be common to all
applications.
Is it possible to include a properties file in the
ApplicationProperties file ?
Is it possible to define messages, with parameters ? that are
defined when
we add the error ?
Is it possible to define resources dynamically ?
In a file like this:
public class Application_en extends java.util.ListResourceBundle
{
static final Object[][] contents = new String[][]
{
//
------------------------------------------------------------------
// --- Error messages
---
//
------------------------------------------------------------------
{ "ErrNotYetImplemented" , "METHOD NOT YET
IMPLEMENTED !"},
....
}
}
I prefer the declaration method with the properties file but it is
not necessarily
the choice made for a project. I would like to know if the
properties file is the
only way with Struts to define messages.
Thanks a lot in advance,
Sandra
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>