struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Vincent Craven" <>
Subject Getting MessageResources from Action
Date Tue, 17 Jun 2003 16:13:49 GMT
I need to break some with the MVC model, and
output information from within my Action.

Specifically, I have a long running process that I
give status updates to the user by putting info on
the output stream and then flushing it.

My problems is that I want the messages displayed
to the user to come from the application resources
file. I've tried the code below, but getPageContext
returns a null. I assume because I'm not really in
a jsp/page. But I don't know another good way to get
a message resources object. Can anyone offer advice?

JspFactory factory = JspFactory.getDefaultFactory();

PageContext pageContext = factory.getPageContext(
	null,  // errorPageURL
	false, // needsSession
	true   // autoFlush

messages = (MessageResources) pageContext.getAttribute(Action.MESSAGES_KEY,
out.print( messages.getMessage(defaultLocale,"errors.mymessage",
myparametervalue) );

Paul Vincent Craven

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message