You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "rnmixon@qwest.net" <rn...@qwest.net> on 2005/08/25 03:42:15 UTC

Include directive works strangely in Tomcat 4.1

I was trying to include a bit of common Java code using the include
directive. But it appears to not be working as I would expect. A few places
I checked include:
  http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/JSPIntro8.html

The gist is that the included file should be inserted inline to the JSP at
translation time (from JSP to .java before being compiled).

But what I am seeing in the generated Java code is that the actual code is
not included/translated inline. Instead vector of includes is built  like
the following:

  static {
    _jspx_includes = new java.util.Vector(9);
    _jspx_includes.add("/header.jsp");
    _jspx_includes.add("/authentication.jsp");
    _jspx_includes.add("/sessionCheck.jsp");
    _jspx_includes.add("/accessCheck.jsp");
    _jspx_includes.add("/header_banner.jsp");
    _jspx_includes.add("/client_admin_menu.jsp");
    _jspx_includes.add("/include_add_update_member_1.jsp");
    _jspx_includes.add("/include_add_update_member_2.jsp");
    _jspx_includes.add("/footer.jsp");
  }


Here is the error I am getting:

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 48 in the jsp file: /client_admin_add_member.jsp

Generated servlet error:
    [javac] Compiling 1 source file

/var/tomcat-dev/work/Standalone/firedrumtestaccount.com/_/client_admin_add_m
ember_jsp.java:702: cannot find symbol
symbol  : variable fieldNames
location: class org.apache.jsp.client_admin_add_member_jsp
			fieldNames = new String[cftdl.getList().size()];
                        ^

Below is the relevant piece of the JSP. Can anyone explain this ?

Thanks - Richard
 

<%@ include file="header.jsp" %>
<%@ taglib uri="/WEB-INF/strtaglib.tld" prefix="str" %>
<%@ taglib uri="/WEB-INF/filetaglib.tld" prefix="file" %>
...
<table width="770" border="0" align="center" cellpadding="0"
cellspacing="0" class="table01">

  <tr> 
    <td width="770"><%@ include file="header_banner.jsp" %>    

    <%@ include file="client_admin_menu.jsp" %>	  
    <%
      ...
		CategoryData category = null;
        %>
        
        <%@ include file="include_add_update_member_1.jspf" %>
        
		<%
   ...
    			memberadded = true; 
        	%>
        
    	    <%@ include file="include_add_update_member_2.jspf" %>
        
			<%
			}
  ...
                        %>


--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Include directive works strangely in Tomcat 4.1

Posted by Tim Funk <fu...@joedog.org>.
Hopefully, you are declaring fieldNames somewhere - but for some reason - the 
  scope is probably is not correct. Looking into more detail translated jsp 
for fieldNames should do the trick.

the static block is a helpful feature that lets the jsp compiler re-compile 
if on eo the files if depends on changes. (Since these are compile time 
includes, not run time includes)

-Tim


rnmixon@qwest.net wrote:
> I was trying to include a bit of common Java code using the include
> directive. But it appears to not be working as I would expect. A few places
> I checked include:
>   http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/JSPIntro8.html
> 
> The gist is that the included file should be inserted inline to the JSP at
> translation time (from JSP to .java before being compiled).
> 
> But what I am seeing in the generated Java code is that the actual code is
> not included/translated inline. Instead vector of includes is built  like
> the following:
> 
>   static {
>     _jspx_includes = new java.util.Vector(9);
>     _jspx_includes.add("/header.jsp");
>     _jspx_includes.add("/authentication.jsp");
>     _jspx_includes.add("/sessionCheck.jsp");
>     _jspx_includes.add("/accessCheck.jsp");
>     _jspx_includes.add("/header_banner.jsp");
>     _jspx_includes.add("/client_admin_menu.jsp");
>     _jspx_includes.add("/include_add_update_member_1.jsp");
>     _jspx_includes.add("/include_add_update_member_2.jsp");
>     _jspx_includes.add("/footer.jsp");
>   }
> 
> 
> Here is the error I am getting:
> 
> org.apache.jasper.JasperException: Unable to compile class for JSP
> 
> An error occurred at line: 48 in the jsp file: /client_admin_add_member.jsp
> 
> Generated servlet error:
>     [javac] Compiling 1 source file
> 
> /var/tomcat-dev/work/Standalone/firedrumtestaccount.com/_/client_admin_add_m
> ember_jsp.java:702: cannot find symbol
> symbol  : variable fieldNames
> location: class org.apache.jsp.client_admin_add_member_jsp
> 			fieldNames = new String[cftdl.getList().size()];
>                         ^
> 
> Below is the relevant piece of the JSP. Can anyone explain this ?
> 
> Thanks - Richard
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org