The message-resource file is loaded at startup an held in memory as an
instance of org.apache.struts.util.MessageResources. The instance is stored
in the ServletContext. To access it from a JSP, look for the
Globals.MESSAGES_KEY attribute:
<%@ page import="org.apache.struts.Globals" %>
<%@ page import="org.apache.struts.util.MessageResources" %>
<%
MessageResources mr =
(MessageResources)pageContext.getServletContext().getAttribute( Globals.MESSAGES_KEY );
String dbServer = mr.getMessage( "login.db.server" );
%>
...
<td class="left">
<html:text property="dbServer" value="<%= dbServer %>" size="16"/>
</td>
From a servlet, it's
import org.apache.struts.util.MessageResources;
...
MessageResources mr =
(MessageResources)request.getSession().getServletContext().getAttribute(
Globals.MESSAGES_KEY );
String dbServer = mr.getMessage( "login.db.server" );
On Friday 20 February 2004 09:27, Slattery, Tim - BLS wrote:
> > how can i add the test value to the html:text like below
> >
> > <bean:define id="test" name="testForm"
> > property="testers.testerName"/>
> > <html:text name="username" value='<bean:write name="test"/>'/>
>
> You can't nest tags, but you can use the "el" version of the Struts html
> tags:
>
> <html-el:text name="username" value="${testForm.testers.testerName}"/>
>...
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]