Actually the problem rests in that the include directive is processed when the JSP 
page is
translated into a servlet class, not at request/run time. The relative URL given as 
the parameter
of the directive must be resolved at translation,and therefore must be a constant 
value string.
In your case , the JSP translator has no idea what will be the future value of 
"appPath", and so
cannot include it.

The solution :
Try the <jsp:include > action, which resolves at request time.




--- "Galbreath, Mark" <[EMAIL PROTECTED]> wrote:
> Try <%= instead of <% for the assignment.  (And I hope you already tried
> this instead of wasting our time....)
>
> -----Original Message-----
> From: raju punith [mailto:[EMAIL PROTECTED]]
> Sent: Friday, October 04, 2002 12:23 AM
> To: [EMAIL PROTECTED]
> Subject: problem with <@include file %>
>
>
> Hi everyone,
>
> following is my jsp snippet .
>
>
> <html>
>   <head>
>      <title>Home Page</title>
>   </head>
>   <body>
>      <% String applPath =
> application.getInitParameter("WEBAPP");%>
>      <%@ include file = "<%=appPath%>/body.inc"%>
>      <%@ include file = "<%=appPath%>/banner.inc"%>
>
>      <% String userName = (String)
> session.getAttribute("userName"); %>
>
>         <% if (null == userName) {%>
>            <%@ include file =
> "<%=appPath%>/navbar_no_logout.inc"%>
>              <%} else {%>
>                <%@ include file =
> "<%=appPath%>/navbar_with_logout.inc"%>
>             <%}%>
>
>       <#### rest of the code  ########>
>
>         </body>
>
> </html>
>
>
> the problem: when i invoke the jsp i get the following
> error
>
> org.apache.jasper.compiler.CompileException:
> /index.jsp(23,9) File "<%=appPath%>/body.inc" not
> found
>         at
> org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspParseEve
> ntListener.java:789)
>
>
> any help would be much appreciated.
>
>
> Thanks
>
>
>
> __________________________________________________
> Do you Yahoo!?
> New DSL Internet Access from SBC & Yahoo!
> http://sbc.yahoo.com
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>


=====

Mark Zawadzki Performance Engineer/DBA/Programmer extraordinaire’ [EMAIL PROTECTED] 
[EMAIL PROTECTED]

 "Democracies die behind closed doors," - Judge Damon Keith


__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to