Jsp:Include VS @ include

Hi,
Is there a big diffrence between using <%@ include file="url" %> and <jsp:include page="relative URL" flush="true"/>?
I know that the first is put in the servlet at the translation and the second is included when the page is requested. I use this for my web pages header which is the same for every page. Which one would be the best?
thanks,
Stephane

Hi,
Is there a big diffrence between using <%@ include
file="url" %> and <jsp:include page="relative URL"
flush="true"/>?This question has been answered many times :-)
http://www.google.com/search?q=difference+between+include+directive+and+jsp+include
>
I know that the first is put in the servlet at the
translation Here's the full official description on include directive:
http://java.sun.com/products/jsp/syntax/2.0/syntaxref209.html#1003408
and the second is included when the page
is requested. Here's the description on jsp:include
http://java.sun.com/products/jsp/syntax/2.0/syntaxref2020.html#8828
I use this for my web pages header
which is the same for every page. Which one would be
the best?Think about the future changes, in the future will you ever add dynamic content to the header? Then go with jsp:include or if you are into JSTL use c:import
If you are very sure that you don't need to add dynamic code to the header then go with the include directive. But be sure of this, otherwise you;ll have to change all JSP headers -- probably with search and replace --- but still it will be a PITA.
Another option is you could set coda and prelude in web.xml , that will auto include static content in all JSP pages --- with coda and prelude specified in web.xml you don't have to include files in the JSP pages themselves. But the disadvantage is that the header and footer will appear before the opening html and after the closing html tag.
>
thanks,
Stephane

Similar Messages

  • Jsp taglibs in include files not detected, throws errors, no code insight

    I have a jsp which is included in all the other jsp. it looks something like this
    taglibs.jsp
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
    <%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
    <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
    test.jsp
    <%@ include file="/jsp/menu/taglibs.jsp"%>
    <html>
         <head>
              <title>Tours</title>
         </head>
         <body>
    <form:form commandName="testCommand">
                   <form:hidden path="tour.firstname" id="tour.firstname" />
    and so on.
    I am having 2 problems
    1. the jsp editor show errors all over the place saying
    element path not expected
    element commandName not expected etc.
    2. no code insights.
    but if i include the taglib def in test.jsp it dosn't show any error and also provides code insights. but seldom do people include all taglibs in all jsps.
    is there a way for Jdeveloper to show code insights in jsp pages which includes a jsp or like xml schemas could be added at some place(tools-pref-xml schemas) and when used anywhere, would provide code insights.

    am not sure, try with this
    <jsp:include   .../>

  • Failure in Precompilation of JSPs  due to include file in WL6.1 SP2

    Hi
              We are getting the following error when we try to do precompilation of JSPs using
              precompile param to true in weblogic.xml
              We are deploying our application as war files.
              eagerly waiting for your help
              sincerely
              Ramesh
              Issue description and StackTrace:
              Issue:
              Precompilation of JSPs fail while using precompile param to true in weblogic.xml and deploy it as War file. It is througing "failure pre-compiling JSP's
              weblogic.utils.ParsingException: nested TokenStreamException: antlr.TokenStreamE
              xception: Could not include index.jsp" exception.
              OS: Windows 2000
              Jdk: Sun Jdk1.3.1
              Weblogic: 6.1 SP2
              ***Stacktrace*************
              <Dec 17, 2002 1:05:51 PM CST> <Error> <HTTP> <[WebAppServletContext(3961036,AdvW
              eb,/AdvWeb)] failure pre-compiling JSP's
              weblogic.utils.ParsingException: nested TokenStreamException: antlr.TokenStreamE
              xception: Could not include index.jsp
              at weblogic.servlet.jsp.JspLexer.parse(JspLexer.java:1025)
              at weblogic.servlet.jsp.JspParser.doit(JspParser.java:80)
              at weblogic.servlet.jsp.JspParser.parse(JspParser.java:183)
              at weblogic.servlet.jsp.Jsp2Java.outputs(Jsp2Java.java:119)
              at weblogic.utils.compiler.CodeGenerator.generate(CodeGenerator.java:255
              

    Ramesh,
              We experienced this sympton as well. In our JSPs, we converted
              <%@ include file="xyz.jsp"%> (static include, source time) to
              <jsp:include page="licensedQuote.jsp"/> (dynamic include, run time)
              and the problem went away.
              We still use static includes at the very start of the JSPs. It seems the problem only occurs when the static include is inside of a tag whose body does JSP evaluation.
              -Charlie
              "Ramesh Danala" <[email protected]> wrote in message news:[email protected]...
              > Hi
              > We are getting the following error when we try to do precompilation of JSPs using
              > precompile param to true in weblogic.xml
              > We are deploying our application as war files.
              > eagerly waiting for your help
              > sincerely
              > Ramesh
              >
              > Issue description and StackTrace:
              > Issue:
              >
              > Precompilation of JSPs fail while using precompile param to true in weblogic.xml and deploy it as War file. It is througing "failure pre-compiling JSP's
              > weblogic.utils.ParsingException: nested TokenStreamException: antlr.TokenStreamE
              > xception: Could not include index.jsp" exception.
              >
              > OS: Windows 2000
              > Jdk: Sun Jdk1.3.1
              > Weblogic: 6.1 SP2
              >
              > ***Stacktrace*************
              >
              > <Dec 17, 2002 1:05:51 PM CST> <Error> <HTTP> <[WebAppServletContext(3961036,AdvW
              > eb,/AdvWeb)] failure pre-compiling JSP's
              > weblogic.utils.ParsingException: nested TokenStreamException: antlr.TokenStreamE
              > xception: Could not include index.jsp
              > at weblogic.servlet.jsp.JspLexer.parse(JspLexer.java:1025)
              > at weblogic.servlet.jsp.JspParser.doit(JspParser.java:80)
              > at weblogic.servlet.jsp.JspParser.parse(JspParser.java:183)
              > at weblogic.servlet.jsp.Jsp2Java.outputs(Jsp2Java.java:119)
              > at weblogic.utils.compiler.CodeGenerator.generate(CodeGenerator.java:255
              > )
              

  • Accessing JSP variables in Included Javascript

    Hey All,
    I want to hide my javascript to be viewed on the client browser.
    I know we can do that with the javascript include ,But i am using JSP variables in
    Included javascript.I can't access those variables any more.
    Does anybody know any workarround.
    Thanx
    Vijay

    Hi Vijay,
    I am also facing the same problem of hiding javascript in the client browser. My javascript variables are getting initialised on the fly using JSP. Since JSP is compiled on the server side, one can't compile .js file on the client side.
    What u can do is to divide your page into frames with
    <frameset rows="100%,0%">. Now put your form hidden fields or the .js file in frame 2 which is not visible to the user and then assign your jsp variables in the frame2 html/jsp page. Now access your variables from frame2 in frame1 using
    var i = parent.frames[1].document.forms[0].elements[0].value
    Assuming that there is 1 form and 1 hidden field in frame2 html/jsp page.
    I hope u get the logic rite....
    I had done it for application but problem is that our users are real MORONS and they keep doing ctrl+F5 which takes them to the Indexpage.
    If you get some other solution then please mail it to my email address
    [email protected]
    Regards
    Vimlesh

  • JSP question on includes

    Okay here's what is happening.
    We have a header and footer file that we want to include across all jsp's in the site.
    We also have a an organization that looks something like this
    /example
    /graphics
    icon1.jpg
    icon2.jsp
    /admin
    admin.jsp
    adminResult.jsp
    /example
    example.jsp
    exampleResult.jsp
    index.jsp
    news.jsp
    profile.jsp
    header.jsp
    footer.jsp
    The problem is that header and footer are both referencing images in their folder, but when admin or example try to view them, the images can't be found because I'm using the base tag. (If I didn't have the base tag, I'd see some strange results.)
    Is there an easy way around this problem so that all the jsps can correctly include the header and footer without the busted graphics?
    TIA.

    One way would be to use an absolute path to the images.

  • Difference between jsp:include and %@ include

    what is the difference between <jsp:include> and <%@ include %>? which has better performance? When to use which? suppose i have a menu that should be included in every page, which should I use?
    Thank you
    Cal

    <%-- some date this page was last updated with that particular version of JSP file --%>
    <% include file="relative URL" %>
    You use the include directive, as indicated, to include a file in the main JSP file at the time the file is translated into a servlet. This is done at translation time and therefore if the included JSP file changes, all the JSP files that use this included file will need tobe updated. If you use this include statement then i would suggest that you add a date descriptor of the last time it was modifed so that you can go back and tell if you have updated a particular JSP file or not.
    <jsp:include page="relative url" flush = "true" />
    When you use the JSP descriptor like this, you are getting the requested JSP file at REQUEST time and therefore you do not hae to worry about updating the calling JSP page.
    Hope this helps

  • Passing information from one jsp to an included jsp

    I have one jsp page that includes many other jsp pages (using the include page directive) [there are many good reasons to have these pages separate, else I would love to just make them one at this point]
    I need to get information in jsp page 1 from the request. This information may or may not be there, may or may not be encrypted. If the information is not there, I am prepared to make an assumption. This said, my challenge lies in trying to do this once and make the information available to the included pages.
    I am using version 1.0 of JSP and the include page, param solution does not work for me.
    This is URGENT! Thank you in advance for any assistance.
    michelle

    Hi Michelle,
    1. I'm using Jsp 1.1. I'm not how Jsp1.0 behaves.
    Just try 2 or 3 depending on your need in waiting
    for more input.
    2. We can't pass data using include directive as:
    <%@ include file="to.jsp"%>
    3. We can pass data using include action as:
    <jsp:include page="to.jsp" flush="true">
         <jsp:param name="fname" value="FirstName"/>
         <jsp:param name="lname" value="LastName"/>
         <jsp:param name="age" value="11"/>     
    </jsp:include>
    -- Paul.

  • Copying standard prog to custome program with includes that includes hd inc

    Hi gurus,
    i got one requirement,
    I have to copy standard program to custome program with includes ,that includes con tain few more includes. so how can i copy all the includes into the custome progam.
    please tel me.

    Hi Vijayam,
    In SE38, give the name of the standard program, in menubar goto program -> copy, which will take you to a pop up, check the checkbox for 'INCLUDES' to copy all the standard includes.  But this will not copy the custom includes(starting with Z). To copy the custom include, you need to create new include in your copy program.To create a new include, click on icon 'Display Object List' which will display the objects list for your program, now right click on your program name in this list and select CREATE-> INCLUDE. Give the name of include and now copy the code from standard program include to your include.
    I hope your problem is solved now.
    Regards,
    Pranjali

  • Is Customising Include and Include structures same?

    Hi,
    Could any one tell me
    whether
    Is Customising Include and Include structures same?

    hi,
    Structures can be included in tables or other structures to avoid redundant structure definitions.
    A table may only be included as an entire table.
    A chain of includes may only contain one database table. The table in which you are including belongs to the include chain. This means that you may not include a transparent table in a transparent table.
    Includes may contain further includes.
    Foreign key definitions are generally imparted from the include to the including table. The attributes of the foreign key definition are passed from the include to the including table so that the foreign key depends on the definition in the include.
    Append structures are used for enhancements that are not included in the standard. This includes special developments, country versions and adding customer fields to any tables or structures.
    An append structure is a structure that is assigned to exactly one table or structure. There can be more than one append structure for a table or structure.
    The following enhancements can be made to a table or structure TAB with an append structure:
    ·        Insert new fields in TAB,
    ·        Define foreign keys for fields of TAB that already exist,
    ·        Attach search helps to fields of TAB that already exist,
    These enhancements are part of the append structure, i.e. they must always be changed and transported with the append structure.
    When a table or structure is activated, all the append structures of the table are searched and the fields of these append structures are added to the table or structure. Foreign keys and search help attachments added using the append structure are also added to the table. If an append structure is created or changed, the table or structure assigned to it is also adjusted to these changes when the append structure is activated.
    Since the order of the fields in the ABAP Dictionary can differ from the order of the fields on the database, adding append structures or inserting fields in such append structures does not result in a table conversion.
    The customer creates append structures in the customer namespace. The append structure is thus protected against overwriting during an upgrade. The fields in the append structure should also reside in the customer namespace, that is the field names should begin with ZZ or YY. This prevents name conflicts with fields inserted in the table by SAP.
    A Customizing include is a structure that satisfies a special naming convention. The name of a Customizing include begins with ‘CI_’ and the include is in the customer namespace.
    If enhancements are already planned in the standard using customer-specific fields, such Customizing includes are included. in the corresponding standard table or standard structure. The Customizing include (that is the definition of the structure itself) is usually first created in the customer system and filled with fields by special Customizing transactions.
    Customers can thus enhance tables and structures of the standard system without themselves having to modify the table and structure definitions. This means that these enhancements will not be lost when upgrading. If a table or structure of the standard system is enhanced with customer fields using a Customizing include, these customer fields are automatically inserted in the new delivered table or structure definition during an upgrade.
    If you create a Customizing include for a table or structure, only those enhancements are allowed that are consistent with the enhancement category of the enhanced table or structure. For more information, see Structure Enhancements.
    Customers can but need not create a Customizing include and fill it with fields. If there is no Customizing include, there is no error message when the table or structure including it is activated.
    A Customizing include can be contained in several tables or structures, so that they remain consistent when the include is modified.
    Hope this helps. Do reward.
    Edited by: Runal Singh on Mar 19, 2008 2:39 PM

  • JSP demo PTS included with Oracle 9i Developer Release for Mac not working

    Hello all, please pardon my ignorance, but I am an Oracle DBA not a JSP programmer.
    I have installed Oracle 9i developer release for Mac OSX and it included a demo application in JSP called pts.
    I followed all the instruction and it still doesn't seem to work.
    When I try to login to the application I get the following exception:
    exception
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 3 in the jsp file: /oradev/pts/solmktinit.inc
    Generated servlet error:
    [javac] Since fork is true, ignoring compiler setting.
    [javac] Compiling 1 source file
    [javac] Since fork is true, ignoring compiler setting.
    [javac] /usr/local/jakarta-tomcat-4.1.24/work/Standalone/localhost/_/oradev/pts/login_jsp.java:7: cannot resolve symbol
    [javac] symbol : class DBAccess
    [javac] location: package pts
    [javac] import oradev.pts.DBAccess;
    I'm not sure what this means or how to fix it. I'm sure it's something simple like modifying my classpath or something, but, as I said, I don't know where to begin.
    Any assistance or suggestions would be greatly appreciated.

    Can't you just use the 10g client ?
    I have not tested the 9i dev. with oci calls but I would not be surprised if you try this on tiger. That won't work AFAIK.
    regards,
    Ronald.
    http://homepage.mac.com/ik_zelf/oracle

  • New jsp to be included on onChange event

    Hi,
    I have a dropdown box in JSP... Based on the selection I make in it, a new jsp is to be included in the same page.How do i do that with an onChange event?
    Any help is appreciated.
    Thanks in advance

    reload ur page on each change event

  • Details on JSP error page include...

    I have a scenario as defined below:-
    There are two JSPs, A_page.jsp and B_page.jsp.
    They have AERROR.jsp and BERROR.jsp defined as error pages for them respectively.
    Case1:- If A_page.jsp includes B_page.jsp using include directive.
    In case there is an error, which error page will be shown, AERROR.jsp or BERROR.jsp?
    Case2:- If A_page.jsp includes B_page.jsp using JSP action.
    In case there is an error, which error page will be shown, AERROR.jsp or BERROR.jsp?
    Please clarify...
    Thanks in advance... ;-)

    call.jsp
    <%@page errorPage="first.jsp" %>
    <%=1/0%>
    first.jsp
    <%@page isErrorPage="true" %>
    <%="errorfirst"%>
    <%@include file="second.jsp" %>
    second.jsp
    <%@page isErrorPage="true" %>
    <%="errorSecond"%>
    output
    errorfirst errorSecond
    (so it will display all first and second error jsp`s)...
    its like a sub call (or) inline call in c++...
    and vice versa

  • Equivalent function of JSP:include or @include?

    Could someone please let me know how I can include html pages in a java servlet page? I am looking for similar function as JSP include. A simple example would be must appreciated. Thanks!

    Thanks for you reply. Actually, what I want to do is to import/include a static html page to my java servlet page. I do not want to use JSP because all the pages created were sevlet. I found out a way that using getServletcontext.getResource to read in the html page and print it out from the servlet. Just wondering that if there is a better way to do this?

  • JSP tag spanning @include files

    Weblogic 5.1 sp 9
              Windows 2000
              inc1.inc:
              <x:customtag>
              inc2.inc:
              </x:customtag>
              body.jsp:
              <%@ include file='inc1.inc' %>
              ...[body stuff here] ...
              <%@ include file='inc2.inc' %>
              hitting this page gives:
              java.lang.RuntimeException: Could not parse embedded JSP code:
              weblogic.utils.ParsingException: Could not complete parsing, unmatched tags:
              customtag
                   at weblogic.servlet.jsp.JspLexer.parseJspCode(JspLexer.java:1079)
                   at weblogic.servlet.jsp.JspLexer.parseJspCode(JspLexer.java:1057)
                   at weblogic.servlet.jsp.JspLexer.parseJspCode(JspLexer.java:1050)
              Why is this not valid? Other JSP engines allow this. Doesn't the @include
              directive just pull in code at .java source generation time?
              Thanks,
              j
              

    This does look like a bug. I have tried it too with SP6. Contact support with
              the same problem. [email protected]
              Shiva.
              Jason Collins wrote:
              > Weblogic 5.1 sp 9
              > Windows 2000
              >
              > inc1.inc:
              > <x:customtag>
              >
              > inc2.inc:
              > </x:customtag>
              >
              > body.jsp:
              > <%@ include file='inc1.inc' %>
              > ...[body stuff here] ...
              > <%@ include file='inc2.inc' %>
              >
              > hitting this page gives:
              >
              > java.lang.RuntimeException: Could not parse embedded JSP code:
              > weblogic.utils.ParsingException: Could not complete parsing, unmatched tags:
              > customtag
              > at weblogic.servlet.jsp.JspLexer.parseJspCode(JspLexer.java:1079)
              > at weblogic.servlet.jsp.JspLexer.parseJspCode(JspLexer.java:1057)
              > at weblogic.servlet.jsp.JspLexer.parseJspCode(JspLexer.java:1050)
              > ...
              >
              > Why is this not valid? Other JSP engines allow this. Doesn't the @include
              > directive just pull in code at .java source generation time?
              >
              > Thanks,
              > j
              

  • Error when deploy a jsp page which includes customizable component

    Hi all,
    I add a customizable component to my jsp page. It works fine on local but when I deploy it and run the deployment I get the error below:
    500 Internal Server Error
    OracleJSP:
    JSP Error:
    Request URI:/islistesi/DevamEdenIsler.jspx
    Exception:
    java.lang.IllegalStateException: ClassLoader "islistesi.web.islistesi:0.0.0" (from <web-module> in /oc4j/webcenter/j2ee/home/applications/islistesi/islistesi/): This loader has been closed and should not be in use.
    anyone who has an idea?
    thanks a lot in advance

    Did you define a web.xml and application.xml file for the deployment of your application?
    Are you using deployment profiles to configure your application on a standalone OC4J?

Maybe you are looking for

  • Changes to multiprovider

    Dear Gurus, multiprovider got 10cubes and we added recently new cube to that we created some queries on the multiprovider when we run the queries it doest shown any data do we have to do anything after changes done to multiprovider. the queries for o

  • Weblogic JVM usage

    Is there a limit on the amount of ram that the server jvm can use?

  • Frames Dropping when Editing back to tape

    I just updated my Final Cut Studio to 5.1.4. I am running this program on 2.0 GHz G5 Power Mac. I have fibre from the G5 to the server. I am trying to Edit to tape and this edit stop because it had dropped one or more frames. I am at OS 10.4.9 The er

  • Using list values

    I would like to know if there is a way to do pass a parameter p_Parameter having a value of say A1, A2,A3,....An for a query in PL/SQL stored procedure for a query such as : Select * From Employee where EmpId in (p_Parameter) I was able to resolve th

  • Issue in adding qualification using PPPM

    Hi All, I am trying to add a qualification record for a person using CHANGE PROFILEs transaction PPPM.  I add that record with start date as a date in 2010  (eg: 01.02.2010) and end date as (31.12.9999)  and save it. When I open the employee profile