Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Struts
Search Coderanch
Advance search
Google search
Register / Login
Win a copy of
Eclipse Collections Categorically: Level up your programming game
this week in the
Open Source Projects
forum!
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
paul wheaton
Ron McLeod
Jeanne Boyarsky
Sheriffs:
Paul Clapham
Saloon Keepers:
Tim Holloway
Roland Mueller
Bartenders:
Forum:
Struts
How to share variables in Struts tiles?
Jeppe Sommer
Ranch Hand
Posts: 270
posted 20 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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?
<%@ taglib uri="WEB-INF/struts-tiles.tld" prefix="tiles" %> <tiles:insert page="test.jsp" flush="true"> <tiles :-P ut name="init" value="includes/Init.jsp" /> <tiles :-P ut name="title" value="Page Title" /> <tiles :-P ut name="top_panel" value="template/toppanel.jsp" /> <tiles :-P ut name="top_menu" value="includes/menu_toppanel.jsp" /> <tiles :-P ut name="body" value="template/body.jsp" /> </tiles:insert>
Marc Peabody
pie sneak
Posts: 4727
I like...
posted 20 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Set the variables to a scope (request, session, application).
A good workman is known by his tools.
Jeppe Sommer
Ranch Hand
Posts: 270
posted 20 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Will you give an example, please?
Her is some piece of my Init.jsp file:
<% dbConn.DBConn db = null; java.sql.Connection conn = null; java.sql.PreparedStatement stat = null; java.sql.ResultSet rs = null; StringBuffer str = null; js.util.Date obj_date = new js.util.Date(); String acceptLanguageString = request.getHeader("Accept-Language"); ... %>
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 ]
I knew I would regret that burrito. But this tiny ad has never caused regrets:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Tiles & Validator
How tiles are resolved in a JSP page
Problem in resolving an issue in Tiles
Tiles Question - howto solve variety body ?
Tiles winding me up.
More...