Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!
  #1  
Old July 16th, 2002, 04:32 AM
socrates73 socrates73 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Posts: 0 socrates73 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Application Development

Hello, I have a quick question... does JSP have something similar to Coldfusions Application.cfm file? I would like to run some code (say application.jsp) before any of the other files are accessed....

I know I can include application.jsp in every file, but I would prefer not to. Thanks.

Reply With Quote
  #2  
Old July 16th, 2002, 09:50 PM
socrates73 socrates73 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Posts: 0 socrates73 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
! got another question.... is there any way to include a file using a variable in the include statemen (example below):

String filename = test.jsp;
<%@ include file= filename %>

Thanks.

Reply With Quote
  #3  
Old July 17th, 2002, 10:13 AM
jnicholas jnicholas is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Posts: 5 jnicholas User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
Originally posted by socrates73
! got another question.... is there any way to include a file using a variable in the include statemen (example below):

String filename = test.jsp;
<%@ include file= filename %>

Thanks.


I think you have the two include methods mixed up. The one you've used above is a static include. It only happens on the first compile. It can't be dynamic because it happens before code is run or even generated.

The method you would use to dynamically include another file is <jsp:include page="test.jsp" flush="true" />. If you want to use a variable you can do it like this:

<% String filename = "test.jsp"; %>
<jsp:include page="<%=filename %>" flush="true" />

you can also send parameters to the included file like this:
<jsp:include page="test.jsp" flush="true">
<jsp:param name="parametername" value="parametervalue" />
</jsp:include>

The param value can be a variable using the <%=variable %> syntax as well

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > Application Development


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway