|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
! 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. |
|
#3
|
|||
|
|||
|
Quote:
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 |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Java Help > Application Development |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|