File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
OCA Java SE 8 Programmer I Study Guide 1Z0-808
this week in the
How to share variables in Struts tiles?
Joined: Jan 07, 2004
Jun 17, 2005 14:45:00
class called Init.jsp I define some variables that has to be used by all the jsp pages. An example is:
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>
Joined: Feb 05, 2003
Jun 17, 2005 15:04:00
Set the variables to a scope (request, session, application).
A good workman is known by his tools.
Joined: Jan 07, 2004
Jun 17, 2005 15:13:00
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 ]
It is sorta covered in the
JavaRanch Style Guide
subject: How to share variables in Struts tiles?
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.
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015