%@include  directive

Is there a limit to have only one
<%@include file
in a JSP?

There should not be a limit of only one directive. If you are using JSTL, the c:import tag is supposed to be more efficient.

Similar Messages

  • A variable in the include directive

    Hello,
    I'm trying to store a part of the name of the file to include in a variable like this:
    <%@ include file=templatepath + "settings.jsp" %>
    but it doesn't work. Can someone tell me if there is a working way to do something similar
    Thanks,
    Store

    You can use the jsp:include tag to specify the page to include dynamically.
    <jsp:include page="templatepath + "settings.jsp" flush="true"/>You can't use the include directive to dynamically specify a page since the page is included at compile time, rather than run time.

  • JSP include directive not working with Tomcat 5.0

    Hi.
    I'm developing a small JSF webapp under Tomcat 5.0. My idea was to use the include directive to display a navigation panel on every JSP page.
    I took the code straight from the Java Web Services Tutorial; the resulting page looks like this:
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:h="http://java.sun.com/jsf/html"
           version="2.0">
    <jsp:directive.page contentType="text/html;charset=iso-8859-1"/>
    <%@ include file="/jsp/panelpage_header.inc" %>
         <h:outputText value="Welcome!"/>
    <%@ include file="/jsp/panelpage_footer.inc" %>
    </jsp:root>However, when I try to load the page, a compilation error occurrs:
    org.apache.jasper.JasperException: /trias/welcome2.jsp(11,2) The content of elements must consist of well-formed character data or markup.
         org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
    ...I checked the path to the included files, and it seems to be okay. The files themselves contain the JSF tags for the view, html-head, html-body etc. The compiler doesn't even care if the files exist or not because it aborts immediately when it reaches the first include-statement.
    Did anyone see this kind of error before?

    Ok, the solution with jsp:directive.include works,
    if header.inc and footer.inc themselves are well
    formed too. If I understood the concept right this is
    because header and footer are processed during
    request time and therefore interpreted as
    'standalone' pages.This isn't true. The include directive (<jsp:directive.include>) is run a Compile Time. The code is inserted directly into the surrounding JSP (unlike <jsp:include> which forwards the request at runtime). The finished JSP, after the include, is then processed and needs to be well-formed XML.
    >
    But: What can I do when these two files define a tag
    that should enclose my current page (for example,
    header opens a panelGrid-Tag, and footer closes it).
    For this case I thought the use of the
    @include-directive would be neccessary to combine the
    three pages during compilation. By this the resulting
    page would be well-formed although header and footer
    are not.It should be, as long as you are using <jsp:directive.include>, and the rest of the included pages are also well formed (no <% %> tags, nothing else out of place...).
    Honestly, I haven't done much work with JSP documents, so I haven't run into this problem. But I do believe everything I said is correct.
    What I would do is double check the correctness of the rest of the included pages and see if your error isn't something else.

  • Problems with symlinks and include directives

    Any files that are included with an include directive from a file that is
              contained in a directory that is reached via a soft link do not work
              (resource not found error) if the link begins with "../".
              directory structure is like this:
              docroot/protected/symlinked_dir/subdir1a/subdir2a
              docroot/protected/symlinked_dir/subdir1b/subdir2b
              if a file in subdir2a tries to include a file in subdir2b then the resource
              is not found.
              however if I copy the symlinked directory over then it works.
              to avoid touching the symlink during the include I changed the structure to:
              docroot/protected/symlinked_dir/dummydir/subdir1a/subdir2a
              docroot/protected/symlinked_dir/dummydir/subdir1b/subdir2b
              The same problem remained. However includes in the same directory and in
              child directories work just fine.
              Is this a known bug in Weblogic or a misconfiguration of the treatment of
              symlinks?
              Thanks,
              Chris Eppstein
              

    Hi, Thanks for looking at the code.
    By messing up I mean the CSS seems to break down a bit.  The navigation moves down, the sidebar moves down and across to the right and the whole page moves across to the right side of the browser and the log in form on the top of the page breaks up and there are gaps on the page where they shouldn't be.
    It only does it in Explorer.
    Thanks again for you help.
    Ben.

  • JSP:Include directive - can I access data?

    Hi,
    I am using the 'include' directive (either jsp:include method or <%@ include.... /> ) to include another jsp page.
    I want the included file to access variables that have been set up in the main page (the one with the include directive in it). I've tried several things, including setting up a Bean class, but nothing seems to work
    Is this possible? I really appreciate any help with this.
    Thanks.

    You cannot use <%@ include ..%> because that is resolved at translation time. <jsp:include /> is resolved dynamically and should give you what you need. In the main page, store references to the bean or other data as request attributes and then retrieve them in the included page.

  • Include directive in iplanet 6.0SP1

    If I have a include directive
    <%@ page contentType="text/xml; charset=UTF-8" %>
    in jsp then it loads up fine in iplanet 6.0SP1 and shows Japanese characters.
    However when I have the same directive in some declare.jsp and include declare.jsp in another jsp file like:
    <%@ include file='/declare.jsp' %>
    then the webserver doesn't take the utf-8 encoding and doesn't process japanese characters correctly.
    Is this bug fixed in later versions of iplanet? Any help is appreciated.
    Thanks
    Ravi

    This doesn't seem to be an error. This is may be because the maximum characters they allow is 4096 and anything above it might be truncated. Check with Sun Support may be they have a better answer.

  • Dynamic file parameter with include directive

    I would like to include the file path contained in a string variable with the include directive.
    I'm trying to do the following:
    <%
    String var_fileToInclude = "inc/topnav_" + var_sectionType + ".jsp";
    include file=var_fileToInclude;
    %>
    I get the following error:
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: Unable to compile class for JSP:
    An error occurred at line: 6 in the jsp file: /news/special_reports/climate/inc/topnav_includer.jsp
    include cannot be resolved to a type
    3: String var_fileToInclude = "inc/topnav_" + var_sectionType + ".jsp";
    4: out.println( "var_fileToInclude = " + var_fileToInclude );
    5:
    6: include file=var_fileToInclude;
    7:
    8: %>
    Stacktrace:
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
         org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:423)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:317)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:282)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    Any help is greatly appreciated.
    -- Ryan Chapin

    hello,
    Are you able to print the file name. if you are able to print the file name properly then try to include the file as below
    <jsp:include page="<%=filevariablenema%>" flush="true" />
    I hope this will help. Let me know on the same.
    Thanks
    Suresh

  • Compiler Include Directive

    Is there an equivalent to the include directive? I don't mean the import statement, I mean the include directive such as available in many other languages that will place the contents of a file inline with the java source.
    Basically, just like the JSP include. I have a program of about 100 servlets and parts of the code is exactly the same in every servlet.
    The code is too small to create a seperate class and call it from every servlet and I'd consider it needless overhead.
    I've gotten most of the functionality by creating an interface and implementing and using final variables but I have blocks of code that I want inserted inline at different places within some methods. final is okay for variables but I need to insert lines of code, which final won't work for.
    Thanks,
    Bob

    Why not just have all the servlets be subclasses of some servlet class that includes that common code as a method?

  • Does c_rt:import act like include directive or tag

    The include directive <%@ include ... will not recompile when the included file changes. The tag <jsp:inlcude will always re-fetch the included file so new content is picked up immediately.
    How do c:import and c_rt:import behave?
    Can someone point me to a good description of the difference between c and c_rt libraries. The short one or two sentence descriptions I've seen don't really say much.
    Thanks,
    -- Frank

    How do c:import and c_rt:import behave?The JSTL <c:import> tag acts like the <jsp:include> tag - it is evaluated at page runtime.
    It uses either a RequestDispatcher.forward (for local resources on the same application server) or the java.net classes to open a URL connection for remote resources.
    Can someone point me to a good description of the difference
    between c and c_rt libraries. The short one or two sentence
    descriptions I've seen don't really say much.The "c_rt" library is only included for historical reasons. If you are using JSTL and EL expressions, you should not be using the "c_rt" library.
    There is only one functional difference between the two, and it only applies to JSP1.2 containers (eg Tomcat 4).
    The "c" tags work only with el expressions: ${expr},
    The "c_rt" tags work only on standard runtime expressions ie <%= expr %>
    In a JSP2.0 containers (eg Tomcat 5), el expressions ARE runtime expressions, and you can use ${expr} or <%= expr %> interchangably with the JSTL1.1 "c" taglib.
    You should only be using the c_rt library if
    - you have a JSP1.2 container
    - you want to use <%= expr %> with one of the JSTL tags.
    Cheers,
    evnafets

  • Include directive with import tags how to

    I mostly the same classes throughout many of my jsp pages. If I use the include directive to import the classes - it doesn't work. What is the proper directive / way / tag to include those tags? Sorry if I am not wording this properly. Here's an example:
    most of my classes use the following classes so I use the @import tag:
    <%@page import="web.urls.DisplayUrls"%>
    <%@page import = "web.beanObjects.display.DisplayPage"%>
    <%@page import="web.db.admin.TypesDbHandler"%>
    <%@page import="web.db.admin.CategoryDbHandler"%>
    I would like to put all of those in one file and only have one line of code so I don't have to cut & paste into every jsp page whenever there's a change:
    <%@include file="/include/imports.jsp"%>
    Unfortunately this isn't working, it's not recognizing the classes...
    Thanks!

    hi,
    since both the files are located in the same folder, why don't you try the following:
    <%@ include file="hello.jsp" %>
    hope this helps

  • The Include Directive (at Page Translation Time)

    Version: 5.1
              Service Pack: 6
              I am generating the following error when I attempt to manually compile a JSP
              file:
              [jspc] parsing /vobs/projects/public_html//test.jsp:
              WARNING: Failed to include file 'test.inc' in include directive of page
              /test.jsp
              I've attempted practically every permutation of full and relative path
              locations, and cannot get it to work. Weblogic's JSP documentation did not
              have much to say about this either.
              Is anyone aware of a bug in the jsp compiler that would cause such a
              problem?
              

    Really strange, I used absolute path and put it under docroot, and I didn't
              put that folder into my any of my classpaths, the wls can find it without
              any problem. I used wls5.1 and sp6, do I miss sth?
              Thanks.
              mreiche <[email protected]> wrote in message
              news:[email protected]...
              >
              > No, it's not useless to add the include directory to the classpath - due
              to a bug in WLS 5.1,
              > it looks in the classpath for include files that begin with '/'.
              >
              > He is using the absolute path. That's why WL does not find it.
              >
              > Mike.
              >
              > "Tao Zhang" <[email protected]> wrote:
              > >
              > >Anchal Jain <[email protected]> wrote in message
              > >news:[email protected]...
              > >>
              > >> I added the directory that contains the included files to the
              > >> classpath but I still get the error below.
              > >It's useless to add such directory to the classpath. Please remove it.
              > >In order to recompile it dynamically you have to set it up in
              > >weblogic.properties file.
              > >
              > >>
              > >> WARNING: Failed to include file 'authenticate.jsp' in include
              > >> directive of page /analyze.jsp
              > >>
              > >You should inlcude all these jsps under your docroot.
              > >
              > >Make sure the relative path of include directive is right. Or you can use
              > >the absolute path and try.
              > >
              > >> Do I have to compile the included files
              > >> individually and then compile the main jsp?
              > >>
              > >> Any suggestion will be greatly appreciated.
              > >>
              > >> Anchal
              > >>
              > >>
              > >> "Greg Panzer" <[email protected]> wrote:
              > >> >The Weblogic JSP compiler is looking in the classpath for the include
              > >files.
              > >> >
              > >> >When manually compiling the JSPs, put the docroot in the CLASSPATH.
              > >> >
              > >> >Greg Panzer <[email protected]> wrote in message
              > >> >news:[email protected]...
              > >> >> Version: 5.1
              > >> >> Service Pack: 6
              > >> >>
              > >> >> I am generating the following error when I attempt to manually
              compile
              > >a
              > >> >JSP
              > >> >> file:
              > >> >>
              > >> >> [jspc] parsing /vobs/projects/public_html//test.jsp:
              > >> >> WARNING: Failed to include file 'test.inc' in include directive
              of
              > >> >page
              > >> >> /test.jsp
              > >> >>
              > >> >> I've attempted practically every permutation of full and relative
              path
              > >> >> locations, and cannot get it to work. Weblogic's JSP documentation
              did
              > >> >not
              > >> >> have much to say about this either.
              > >> >>
              > >> >> Is anyone aware of a bug in the jsp compiler that would cause such a
              > >> >> problem?
              > >> >>
              > >> >>
              > >> >>
              > >> >>
              > >> >
              > >> >
              > >>
              > >
              > >
              >
              

  • "include directive or jsp:include "

    Hi,
    Which amongst <%@ include file="header.jsp" %> and
    <jsp:include page="header.jsp"/>to be used, when performance is taken into account.

    Code copy from serverside.com
    Is it the same as --> jsp:include and %@ include directive.
    Actually, <jsp:include> vs. <%@ include %> is a different story.
    <%@ include %> is a "compile-time" include. The included file is inserted into the JSP when the JSP compiles.
    <jsp:include> is a "run-time" include. If JSP-1 includes JSP-2, JSP-2 is invoked when JSP-1 executes, and the output of JSP-2 is inserted into the output stream of JSP-1.
    The run-time include runs a bit slowly, but can save a lot of system memory, so in general, the run-time include is preferable. Only use the compile-time include if the include code must be in the same page.
    For example, if you want to use an include that defines a bunch of tag libraries with the taglib directive, it will have to be a compile-time include. If you just want to insert a standard header and footer in your page, a run-time include will be more effecient.
    I hope its enough for you to get an clear cut idea,

  • Which is more useful in include directive and taglibraries

              I am writing some static html tags inside a file.
              This files i need to call from jsp pages.
              one is i can call using include directive.
              other is writing taglibraries.
              Performance and optimization wise which is more appropriate?
              

    There is an include directive and a jsp:include tag. I would suggest that
              performance differences between these are nominal, with the directive being
              slightly faster due to its "inlining nature".
              Don't write your own tags to do this unless you have to. That would be
              silly.
              Peace,
              Cameron Purdy
              Tangosol, Inc.
              http://www.tangosol.com
              +1.617.623.5782
              WebLogic Consulting Available
              "Raaj" <[email protected]> wrote in message
              news:3af02b63$[email protected]..
              >
              > I am writing some static html tags inside a file.
              > This files i need to call from jsp pages.
              > one is i can call using include directive.
              > other is writing taglibraries.
              > Performance and optimization wise which is more appropriate?
              >
              

  • Generate new browser window on using include directive/action tag in curren

    Hi Life line
    if i used jsp include directive/action taag inside my current jsp code it open new browser window but if i
    not use that include directive or action tag in my jsp source it properly display next jsp in
    same browser window
    how i can rid of this .i am confuse why it happens
    thanks
    Vivek Harnal

    1) on clicking view button it submit other page by
    script function()
    2) it work fine & display in same browser window if i
    am not incliudes jsp page after body tag .Your included JSP has a head and body of its own. If the including page has a head and body of its own, then the two will clash. Generally, it is best to make includes be fragments, ie, have no
    <html> <head> </head> <body> </body> </html> tags.
    3) included jsp use for standard menu based Header
    source of included page is
    <script type="text/javascript"
    src="menu_array.js"></script>
    <script type="text/javascript"
    src="mmenu.js"></script>
    <html>
    <script language=javascript>
    function show()
    // Master array in Menu_Array.js contains sub menu
    options available to super administrator
    // show the menu
    {     popup("master")
    function show1(){
    popup("requisition")
    function show2(){
    popup("purchase")
    function show3(){
    popup("receipt");
    function show4(){
    popup("reports");
    </script>
    <head>
    <link rel="stylesheet" type="text/css" href="css.css">
    <title>Procurement Automation System</title>
    <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1">
    <base target="main">This means every link you click on will be sent to a new window or frame whose name is main. If no such window or frame exists, make one. If you do not want your links to bring you to a new window, you need to remove this <base target="main"> line.
    >
    >
    </head>
    <body bgcolor="#FFFFFF" text="#000000" leftmargin="0"
    topmargin="0" marginwidth="0" marginheight="0">
    <table width="982" border="0" cellspacing="0"
    cellpadding="0">
    <tr>
    <td><img src="images/header_inside.jpg" width="1004"
    height="106"></td>
    </tr>
    <tr>
    <td>
    <table width="1012" border="0" cellspacing="0"
    cellpadding="0" bgcolor="#a4c3cd">
    <tr>
    <td width="860" bgcolor="#a4c3cd">
    <table width="819" border="0" cellspacing="0"
    cellpadding="0">
    <tr>
    <td width="5"> </td>
    <td style='cursor: hand' width="113" ><b> </b><A
    onmouseover="javascript:show()"><b>Master
    Module</b></a>
    <td style='cursor: hand' width="142"><b> </b><A
    onmouseover="javascript:show1()"><b>Requisition
    Module</b></a></td>
    <td style='cursor: hand'
    width="149"><b> </b><A
    onmouseover="javascript:show2()"><b>Purchasing
    Module</b></a></td>
    <td style='cursor: hand'
    width="140"><b> </b><A
    onmouseover="javascript:show3()"><b>Receiving
    Module</b></a></td>
    <td style='cursor: hand' width="100"><b>
    </b><A
    onmouseover="javascript:show4()"><b>Reports</b></a></td></tr>
    </table>
    </td>
    <td align="left" width="148">
    <table border=0 cellspacing=0 bgcolor="#a4c3cd">
    <td width="24%" align="center" valign="middle"><a
    href="help.htm" ><img src="images/bt_help.gif"
    width="52" height="20" border="0"></a></td>
    <td width="4%" align="center" valign="middle"><img
    src="images/white_bar.gif" width="2" height="17"></td>
    <td width="32%" align="center" valign="middle"><a
    href="logoff.jsp" target="_self"><img
    src="images/bt_logout.gif" width="70" height="20"
    border="0"></a></td>
    <td width="8%"> </td>
    </table>
    </td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    </body>
    </html>

  • Error: recursive include directive

    Hi,
    I am trying to run iStore from my local box on jDeveloper. I am getting the below error message, anybody has ideas on how to fix it.
    C:\jDeveloper\jdevhome\jdev\myhtml\OA_HTML\OAGlobal.jsp
    Error: recursive include directive
    I am on R12.1.1, and jDev version is 10.1.3.3.0. I installed it from patch # 6863618
    Thanks.

    Have you completed all the steps in these MOS docs?
    How to find the correct version of JDeveloper to use with eBusiness Suite 11i or Release 12.x [ID 416708.1]
    Configuring JDeveloper For Use With Oracle Applications 11i and R12 [ID 330236.1]
    What Setup is Required to Create Custom JSP Pages to Run on the Ebusiness Suite 11i and R12+? [ID 884200.1]
    Thanks,
    Hussein

  • Using the "Include" directive

    Hi,
    Does anyone know how to specify the location from where one
    action script or mxml file can include an other actionscript code?
    For example, I have a file mypanel.mxml that is in project1 and
    myshared.as in project2. I need to "include" myshared.as in
    mypanel.mxml without specifying the physical location of
    myshared.as in the filesystem, to the include directive.
    Please help in this regard.
    Thanks.

    I think you go to your project properties Flex Build Path
    area and add a path to the "Source path" tab.

Maybe you are looking for

  • Macbook doesn't recognise it's Hard drive?

    Hi, Have been having real problems with my macbook over last few months. It would not boot up - just went to screen with flashing ? folder. I have inserted the OSX disc and it now starts up from there but when I try and select a disk to install to it

  • Fast web access

    Is it possible to have a fast web access pdf load only a specified number of pages, at least to start with?  Say the top/first ten pages of a larger pdf? I have a web site which displays a multi page pdf, which is regularly being added to; new pages

  • Issue with Excel add in

    Hi Experts, Some of the users receive the following error message while attempting to retrieve data on a previously-working query in essbase excel add in: "Essbase has encountered an internal Excel error. Your sheet will not be overwritten and none o

  • DW Side Work When the Sourcing System Gets Refreshed

    Dear colleagues, We currently have an ECC 6 Client as the sourcing system feeding data into our QAS BW 3.5 environment (basically Master data and very little transaction data at the moment). Due to the Master Data inconsistency of the sourcing client

  • Alarms disappear on shutdown - can anyone help me?

    I like to set up onscreen reminders (iCal alarms) for important events two weeks in advance. But if I shut down or restart during these two weeks, the iCal alarms are lost. Can I do something to prevent this from happening, or is this a programming o