struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Abdullah Jibaly" <Abdullah.Jib...@aeroxchange.com>
Subject RE: Storing data in session scope
Date Tue, 21 Jun 2005 21:00:24 GMT
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:kaliman.forever@gmail.com]
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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message