It should be getServletContext().setAttribute("tax", "1.23");

-----Original Message-----
From: Abdullah Jibaly 
Sent: Tuesday, June 21, 2005 4:00 PM
To: 'Struts Users Mailing List'; 'Rafael Taboada'
Subject: RE: Storing data in session scope


in web.xml:

<listener>
  <listener-class>com.acme.web.listener.StartupListener</listener-class>
</listener>

StartupListener.java:

public class StartupListener implements ServletContextListener {

    public void contextInitialized(ServletContextEvent event) {
                context.setAttribute("tax", "1.23");
    }
}

in your jsp:

${applicationScope.tax}

Regards,
Abdullah

-----Original Message-----
From: Rafael Taboada [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 21, 2005 3:38 PM
To: Struts List
Subject: Storing data in session scope


Hi folks. I need to store some objects in session scope in order to use 
around the application. What is the best way to do that?
 I need to have TAX value in any place of the application. I thought about 
creating an Action class y call a method which it get TAX data from database 
and then put the value in session scope.
 But when I call for first time index.jsp, it has to call that method... How 
can I do that?. Is it an appropiate way?
 I don't know how to call a method inside an action class from a jsp.
 Thanks in advance

-- 
Rafael Taboada
Software Engineer

Cell : +511-97753290

"No creo en el destino pues no me gusta tener la idea de controlar mi vida"

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to