Thanks Konstadinis and James ! Appreciate the help - had a mental block after a week long Stampede party here in Calgary.
Mike ----- Original Message ----- From: "Konstadinis Euaggelos" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Saturday, February 15, 2003 1:00 PM Subject: Re: How do you access an application.properties value directly from within a class? > You can use this, > <bean:define id="key"><bean:message key='myKey'/></bean:define> > > You can use the key as a scriplet <% =key%> > > > This solution works also in the following case , > if you want to display a title in your button if your write title = > "<bean:message key='myKey'/>" > it willn 't work , > > Following the above solution it works, > > <html:button property="previous" styleClass="Button" > title="<%="["+key+"]"%>" > > <bean:message bundle="BUTTON_RESOURCE_KEY" > key="button.previous"/> > </html:button> > > > > > > ----- Original Message ----- > From: "Mike Deegan" <[EMAIL PROTECTED]> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > Sent: Tuesday, July 15, 2003 7:53 PM > Subject: Re: How do you access an application.properties value directly from > within a class? > > > > Hey Matt / All, > > > > Do you have an elegant way - in scriptlet form - at the JSP level to grab > > an application.properties value to then use as a JSP expression ( > <%=...%>) > > in the "value" attribute of a tag. > > > > I had tried to use the bean:message tag to get the "value" to populate > into > > the "value" attribute of another tag - that is when trying to combine two > > tags - but the page fails to compile. Can't remember the exact error msg > but > > it was along the lines of " = expected ..." > > > > I know you can use JSP expressions ( <%=...%>) in the "value" attribute of > > tags - but JSP compile fails when I try to use bean:message tag to > directly > > populate a tag's "value" attribute. > > > > So do you have an elegant way - in scriptlet form - at the JSP level to > > grab an application.properties value to then use as a JSP expression ( > > <%=...%>) in the "value" attribute of a tag. > > > > I searched for some time for an answer on this but got lost in the maze. > > Maybe the wording of my searches let me down. > > > > Or should I be attempting to do this in another way ... without scriptlets > > ... to get an application.properties value to populate into the "value" > > attribute of another tag. > > > > Any help appreciated ... > > Mike > > > > ----- Original Message ----- > > From: "Raible, Matt" <[EMAIL PROTECTED]> > > To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]> > > Sent: Tuesday, July 15, 2003 10:53 AM > > Subject: RE: How do you access an application.properties value directly fr > > om within a class? > > > > > > > I forgot to add the simplest way in an Action class: > > > > > > MessageResources resources = getResources(request); > > > > > > resources.getMessage("keyName"); > > > > > > > > > -----Original Message----- > > > From: Raible, Matt > > > Sent: Tuesday, July 15, 2003 10:51 AM > > > To: 'Struts Users Mailing List' > > > Subject: RE: How do you access an application.properties value directly > > > fr om within a class? > > > > > > > > > If you're just looking for the values, grab it as a resource bundle. > > Here's > > > how I grab it in a Business Delegate: > > > > > > // Get the application's messages resources > > > ResourceBundle resources = > > > ResourceBundle.getBundle("ApplicationResources"); > > > String appDBVersion = resources.getString("webapp.db_version"); > > > > > > And then of course, there's errors and messages - where it grabs it > > > automagically: > > > > > > errors.add(ActionErrors.GLOBAL_ERROR, > > > new ActionError("errors.existing.user", > > > userForm.getUsername(), > > > userForm.getEmail())); > > > > > > messages.add(ActionMessages.GLOBAL_MESSAGE, > > > new ActionMessage("user.deleted", > > > userForm.getEmail())); > > > > > > And lastly, you can get it from the servlet context in a servlet outside > > of > > > struts: > > > > > > MessageResources resources = > > > ((MessageResources) > > > getServletContext().getAttribute(Globals.MESSAGES_KEY)); > > > > > > resources.getMessage("userFormEx.username"); > > > > > > > > > HTH, > > > > > > Matt > > > > > > -----Original Message----- > > > From: Mark Galbreath [mailto:[EMAIL PROTECTED] > > > Sent: Tuesday, July 15, 2003 10:28 AM > > > To: 'Struts Users Mailing List' > > > Subject: How do you access an application.properties value directly from > > > within a class? > > > > > > > > > When Struts load, it grabs application.properties and stores it's keys > and > > > values somewhere. From within an action class I need to access a value > in > > > application.properties. How could one do this? > > > > > > tia, > > > mark > > > > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]