Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 05-03-2004, 01:11 PM   #1 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,470
sde is on a distinguished road
java includes and vars

head.jsp
index.jsp
foot.jsp

is there any way to pull variables i declared in head.jsp into index.jsp?

i noticed that i had to re-declare all my imports in index.jsp, even though i included head.jsp in index.jsp.

php makes it like one big long page.
__________________
Mike
sde is online now   Reply With Quote
Old 05-03-2004, 05:21 PM   #2 (permalink)
Belisarius
Java fanboy
 
Belisarius's Avatar
 
Join Date: Aug 2003
Posts: 1,148
Belisarius is on a distinguished road
<%@ include file="<whatever>" %>
__________________
GitS
Belisarius is offline   Reply With Quote
Old 05-03-2004, 05:28 PM   #3 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,470
sde is on a distinguished road
yes, i do that.
but lets look at this

thispage.jsp
Code:
String pagetTitle = "This Page";
<%@ include file="head.jsp" %>
now the rest of the page
head.jsp
Code:
<html>
<title><%=pageTitle%></title>
<body>
u see what i mean? i want my vars declared before head.jsp to be recognized in head.jsp... or vars i declare in head.jsp to be recognized in thispage.jsp below where i included the head.

is it possible?
__________________
Mike
sde is online now   Reply With Quote
Old 05-03-2004, 05:54 PM   #4 (permalink)
Belisarius
Java fanboy
 
Belisarius's Avatar
 
Join Date: Aug 2003
Posts: 1,148
Belisarius is on a distinguished road
Ah, I see. Files are processed inside-out. Here's how I handle headers:

Code:
    <jsp:include page="/template/title.jsp">
      <jsp:param name="page_name" value="Administration" />
    </jsp:include>
__________________
GitS
Belisarius is offline   Reply With Quote
Old 05-03-2004, 06:05 PM   #5 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,470
sde is on a distinguished road
hmm .. i haven't seen it done like that.

so what does that part of /template/title.jsp look like?
__________________
Mike
sde is online now   Reply With Quote
Old 05-03-2004, 06:12 PM   #6 (permalink)
Belisarius
Java fanboy
 
Belisarius's Avatar
 
Join Date: Aug 2003
Posts: 1,148
Belisarius is on a distinguished road
It's just a value passed to /template/title.jsp, you can grab it with a request.getParameter("page_name").
__________________
GitS
Belisarius is offline   Reply With Quote
Old 05-03-2004, 06:16 PM   #7 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,470
sde is on a distinguished road
oh hot damn!! thanks!
__________________
Mike
sde is online now   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 10:53 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting