Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to share variables in Struts tiles?

 
Jeppe Sommer
Ranch Hand
Posts: 270
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a jsp class called Init.jsp I define some variables that has to be used by all the jsp pages. An example is:

java.util.Locale ressources = ( java.util.Locale ) init.get("ressources");

At the moment I got an error because the other jsp pages don�t know the variables defined in the init.

cannot resolve symbol ressources

How can I solve the problem?

 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Set the variables to a scope (request, session, application).
 
Jeppe Sommer
Ranch Hand
Posts: 270
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Will you give an example, please?

Her is some piece of my Init.jsp file:


Is that a good way to initialize the parameters, which all the other jsp pages (tiles) are going to use?
[ June 19, 2005: Message edited by: Jeppe Fjord ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic