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

Similar Messages

  • What is the difference between jsp :include and server side include

    what is the difference between jsp :include and server side include(request dispatcher include method)????
    i understand that both request dispatcher include method and jsp:include take dynamic data,so when would one use request dispatcher include and when jsp:include.
    Is the usage interchangeable?i believe jsp include is used only for jsp/html but include directive can be used to include servlets ,jsp and html....correct me if i m wrong and
    do suggest if u hav ny other diff in this context...

    The difference really is: in what format do you want your inclusions? If your environment has many Java developers and only a few designers that focus mainly on, say, Flash, that might push you more towards the server-side include() directive. Or, if you have a large set of pages that receive dynamic content that is displayed in a consistent fashion (such as a workflow header area on a page).
    If, on the other hand, you have more web designers, there may be a greater desire to deal in markup rather than Java code. Java developers themselves might prefer to view markup (JSP) that more resembles the eventual output than something occuring in Java code.
    Finally, there are considerations of tiering. While it is totally possible to (and I have previously) implement 'view classes' that render markup or generate layout templates, JSP's offer, IMO, a subtle, psychological advantage. By forcing a developer to work in a different format, markup versus Java source, the separation on view from controller and model becomes a bit easier. It is still possible to make mistakes, but if a developer at some point notices, "Wait, I'm in a JSP, should I be importing a java.sql class?", then the choice to use JSP includes has paid off in spades.
    - Saish

  • Is there any difference between "jsp:useBean" and "scriptlet" ?

    A few days ago, I asked similar question. But I didn't get the answer I wanted.
    I want to know the differnce between <jsp:useBean../> and <% .. %>(scriptlet).
    I tested in three environments(Oracle Jserv, OC4J, and Apache Tomcat).
    In Oracle Jserv and OC4J, a problem occured. But, Apache Tomcat does not occur a problem.
    For example,
    1) TestClass.java (Bean)
    public class TestClass {
    private String txt;
    public class TestClass {
    txt = "Test"; ----- (g
    public String getTxt() {
    return txt;
    2) test.jsp
    <html><body>
    <% TestClass test = new TestClass(); %> ---(h
    <%= test.getTxt() %>
    </body></html>
    Assume that I visit "http://localhost:8888/test.jsp".
    In Tomcat, if I change "Test"(number(g) to "Test1" and compile the browser shows the change.
    But Oracle Jserv and OC4J does not do that. They also show the old String.
    So, I changed <% TestClass test = new TestClass(); %>(number(h) to <jsp:useBean id="test" class="TestClass" />. That is, I changed "Scriptlet" to "JSP useBean Tag".
    Then, Oracle Jserv and OC4J also show the changes.
    To conclude, is there any difference between "JSP useBean Tag" and "Scriptlet"?
    Can't I use a scriptlet (to make a class) in Oracle Servlet Engine?
    Thanks.

    It could be as simple as the JSP not recompiling between java recompiles - ie, it compiles in the link to the old class.
    Try changing the JSP file (add and delete a space) after you change the java code, and then see what happens.
    Jonny
    null

  • Difference between jsp:forward and logic:forward

    Hi,
    Can anyone let me know??
    what is the difference between <jsp:forward> in and <logic:forward> in struts
    Thanks in advance,
    Regards
    Dhinesh kumar R

    See: http://java.oreilly.com/news/jsptips_1100.html (number 4)

  • Whats the difference between *.jsp and *.jspx

    Hi
    When I create a new jsf page the first step prompts me for the "type". I am wondering what is the difference between JSP Page and JSP Document? Which should I be using? Are there any white papers or documents that explain the advantages of each?
    Also, someone suggested that I use Facelets, has anyone else used these from inside jdeveloper? Any thoughts / tips would be appreciated.
    Thanks
    troy

    JSPX uses an XML doument for you page code - it is the way we recommend you build your page. Makes for cleaner code and easier customization.
    JSP uses HTML with embedded JSF tags in it.

  • Difference between jsp:forward sendRedirect and jsp include directive

    Am very much confused, please explain me the difference between
    jsp:forward sendRedirect and jsp include directive with a suitable example.
    I'll be very gratefull. Its very urgent.

    One basic difference. The include executes in the .jsp servelet created. The redirect transfers "control" by redirecting the client request to another destination. In other words, the current .jsp is no longer in charge or in the calling chain in any way.

  • Difference between append structure and include structure in DDIC

    Plz give me the apt difference between append structure and include structure in DDIC.
    Thanks in advance.
    Regards
    Raj

    This has been discussed please check it in forum
    https://forums.sdn.sap.com/click.jspa?searchID=480466&messageID=114309
    https://forums.sdn.sap.com/click.jspa?searchID=480466&messageID=1419481
    https://forums.sdn.sap.com/click.jspa?searchID=480466&messageID=1479212
    Shortly:
    Append structures are used for enhancements that are not included in the standard. 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.
    http://help.sap.com/saphelp_erp2004/helpdata/en/cf/21eb61446011d189700000e8322d00/content.htm
    Includes are used to group fields, an include structure can be assigned to many tables. If you add a fields to an include structure, all tables/structures, which contain that include structure, will be updated too.
    http://help.sap.com/saphelp_erp2004/helpdata/en/cf/21ea6a446011d189700000e8322d00/content.htm
    Regards,
    Santosh

  • Question about main difference between Java bean and Java class in JSP

    Hi All,
    I am new to Java Bean and wonder what is the main difference to use a Bean or an Object in the jsp. I have search on the forum and find some post also asking the question but still answer my doubt. Indeed, what is the real advantage of using bean in jsp.
    Let me give an example to illustrate my question:
    <code>
    <%@ page errorPage="errorpage.jsp" %>
    <%@ page import="ShoppingCart" %>
    <!-- Instantiate the Counter bean with an id of "counter" -->
    <jsp:useBean id="cart" scope="session" class="ShoppingCart" />
    <html>
    <head><title>Shopping Cart</title></head>
    <body bgcolor="#FFFFFF">
    Your cart's ID is: <%=cart.getId()%>.
    </body>
    <html>
    </code>
    In the above code, I can also create a object of ShoppingCart by new operator then get the id at the following way.
    <code>
    <%
    ShoppingCart cart = new ShoppingCart();
    out.println(cart.getId());
    %>
    </code>
    Now my question is what is the difference between the two method? As in my mind, a normal class can also have it setter and getter methods for its properties. But someone may say that, there is a scope="session", which can be declared in an normal object. It may be a point but it can be easily solved but putting the object in session by "session.setAttribute("cart", cart)".
    I have been searching on this issue on the internet for a long time and most of them just say someting like "persistance of state", "bean follow some conventions of naming", "bean must implement ser" and so on. All of above can be solved by other means, for example, a normal class can also follow the convention. I am really get confused with it, and really want to know what is the main point(s) of using the java bean.
    Any help will be highly apprecaited. Thanks!!!
    Best Regards,
    Alex

    Hi All,
    I am new to Java Bean and wonder what is the main
    difference to use a Bean or an Object in the jsp. The first thing to realize is that JavaBeans are just Plain Old Java Objects (POJOs) that follow a specific set of semantics (get/set methods, etc...). So what is the difference between a Bean and an Object? Nothing.
    <jsp:useBean id="cart" scope="session" class="ShoppingCart" />
    In the above code, I can also create a object of
    ShoppingCart by new operator then get the id at the
    following way.
    ShoppingCart cart = new ShoppingCart();
    out.println(cart.getId());
    ...Sure you could. And if the Cart was in a package (it has to be) you also need to put an import statement in. Oh, and to make sure the object is accessable in the same scope, you have to put it into the PageContext scope. And to totally equal, you first check to see if that object already exists in scope. So to get the equivalant of this:
    <jsp:useBean id="cart" class="my.pack.ShoppingCart"/>Then your scriptlet looks like this:
    <%@ page import="my.pack.ShoppingCart %>
    <%
      ShoppingCart cart = pageContext.getAttribute("cart");
      if (cart == null) {
        cart = new ShoppingCart();
        pageContext.setAttribute("cart", cart);
    %>So it is a lot more work.
    As in my mind, a normal class can also
    have it setter and getter methods for its properties.True ... See below.
    But someone may say that, there is a scope="session",
    which can be declared in an normal object.As long as the object is serializeable, yes.
    It may be
    a point but it can be easily solved but putting the
    object in session by "session.setAttribute("cart",
    cart)".Possible, but if the object isn't serializable it can be unsafe. As the point I mentioned above, the useBean tag allows you to check if the bean exists already, and use that, or make a new one if it does not yet exist in one line. A lot easier than the code you need to use otherwise.
    I have been searching on this issue on the internet
    for a long time and most of them just say someting
    like "persistance of state", "bean follow some
    conventions of naming", "bean must implement ser" and
    so on. Right, that would go along the lines of the definition of what a JavaBean is.
    All of above can be solved by other means, for
    example, a normal class can also follow the
    convention. And if it does - then it is a JavaBean! A JavaBean is any Object whose class definition would include all of the following:
    1) A public, no-argument constructor
    2) Implements Serializeable
    3) Properties are revealed through public mutator methods (void return type, start with 'set' have a single Object parameter list) and public accessor methods (Object return type, void parameter list, begin with 'get').
    4) Contain any necessary event handling methods. Depending on the purpose of the bean, you may include event handlers for when the properties change.
    I am really get confused with it, and
    really want to know what is the main point(s) of
    using the java bean.JavaBeans are normal objects that follow these conventions. Because they do, then you can access them through simplified means. For example, One way of having an object in session that contains data I want to print our might be:
    <%@ page import="my.pack.ShoppingCart %>
    <%
      ShoppingCart cart = session.getAttribute("cart");
      if (cart == null) {
        cart = new ShoppingCart();
        session.setAttribute("cart", cart);
    %>Then later where I want to print a total:
    <% out.print(cart.getTotal() %>Or, if the cart is a JavaBean I could do this:
    <jsp:useBean id="cart" class="my.pack.ShoppingCart" scope="session"/>
    Then later on:
    <jsp:getProperty name="cart" property="total"/>
    Or perhaps I want to set some properties on the object that I get off of the URL's parameter group. I could do this:
    <%
      ShoppingCart cart = session.getAttribute("cart");
      if (cart == null) {
        cart = new ShoppingCart();
        cart.setCreditCard(request.getParameter("creditCard"));
        cart.setFirstName(request.getParameter("firstName"));
        cart.setLastName(request.getParameter("lastName"));
        cart.setBillingAddress1(request.getParameter("billingAddress1"));
        cart.setBillingAddress2(request.getParameter("billingAddress2"));
        cart.setZipCode(request.getParameter("zipCode"));
        cart.setRegion(request.getParameter("region"));
        cart.setCountry(request.getParameter("country"));
        pageContext.setAttribute("cart", cart);
        session.setAttribute("cart", cart);
      }Or you could use:
    <jsp:useBean id="cart" class="my.pack.ShoppingCart" scope="session">
      <jsp:setProperty name="cart" property="*"/>
    </jsp:useBean>The second seems easier to me.
    It also allows you to use your objects in more varied cases - for example, JSTL (the standard tag libraries) and EL (expression language) only work with JavaBeans (objects that follow the JavaBeans conventions) because they expect objects to have the no-arg constuctor, and properties accessed/changed via getXXX and setXXX methods.
    >
    Any help will be highly apprecaited. Thanks!!!
    Best Regards,
    Alex

  • What's the difference between jsp and jsf?

    who can tell me what's the difference between jsp and jsf?
    I'm puzzled when I found some of the technology in jsp is so similar to the ones in jsp( javaserver page)

    Hi,
    Find the difference between JSP and JSF
    1. A developer has more control with JSP, but (should) get easier development with JSF
    2. Event handling is done differently in JSP (HTTP) and JSF (Java)
    3. The UI is designed differently (or should be at least) with JSP (markup) and JSF (components).
    4. The end product should also be defined differently - JSP page versus a JSF application.
    Is this the only thing that is need to make a decision for either or? Probably not. There are other pieces that need to be taken in account when deciding which technology to use - tools support, enough components, type of application etc.... At this point there are not enough JSF components (although there are some interesting projects underway - Ajaxfaces, Myfaces, ADF Faces, and WebChart 3d) and enterprise tools support is still limited to a few tools vendor. Looking at our ADF Faces components they are currently available as early access (not production) and demands for these components are stacking up, literally, outside my office doorstep. Although I would love to make them production - now! - it is not a viable solution since we are still checking features and fixing critical bugs.
    All this combined - not enough enterprise level components in production, lacking tools support etc... - leave customers in a vacuum where the decision is either to continue with JSP, since it is mature and has a wide developer base, or move forward with JSF not sure if the support, or the developers will be there. This is particularly sensitive to customers that need to get started now and be production by summer.
    If you are in this vacuum here are some key points promoting JSF:
    1. Fundamental unit is the Component
    2. Built in event and state management
    3. Component sets can be provided by any vendor
    4. Closer to ASP.Net or Swing development
    5. Choice of UI technology
    6. Scale up (rich clients)
    7. Scale down (mobile devices)
    8. Built into J2EE containers in J2EE 5.0 (tentative)

  • Difference between JSP and JSF

    What is the difference between JSP and JSF?
    Is it necessary to learn JSP before starting with JSF?

    JSP is a view technology providing a template to write plain HTML/CSS/JS in. JSP supports Java based taglibs to generate output and/or control the page flow dynamically. A well known example is JSTL. JSP also supports access to backend data with help of EL (Expression Language).
    JSF is a component based MVC framework which provides taglibs for use in JSP, the JSF core tags in <f:xxx> and the JSF HTML tags in <h:xxx>. Those tags generate HTML output and are tied to JSF component tree in the server memory so that the FacesServlet can work on them to gather request parameters, validate/convert them, update the model values (javabean properties), invoke some actions (javabean action methods) and render the response.
    You can use JSF on top of either JSP or Facelets. Facelets is another view technology. JSP is ancient and has its shortcomings when JSF comes into picture. Facelets is designed with JSF in mind and much more well-suited for it and provides great templating/composition capabilities to reuse specific groups of components without the need to wrap them in another custom component (so that you don't duplicate the same code over and over, e.g. label+input+message.

  • Difference between jsp forward tag and sendRedirect

    I would like to know the difference between jsp forward tag and sendRedirect.
    Please explain with a suitable example if possible ...
    glenn

    See: http://java.oreilly.com/news/jsptips_1100.html (number 4)

  • Difference Between Jsp1.2 and Jsp 2

    Hello All
    Can anyone tell me the difference between Jsp 1.2 and Jsp 2.
    What are disadvantages of earlier version and how they are rectified in this latest version.
    Thank U

    The site below describes the differences and dis/advantages:
    http://developer.java.sun.com/developer/technicalArticles/javaserverpages/JSP20/

  • Differences between Netweaver 2004 and Netweaver 2004s?

    Hi All,
    Can anyone please explain me in details the major differences between Netweaver 2004 and Netweaver 2004s.
    Thanks in advance
    Regards
    Henry

    Hi Henry,
      This content i got from experts:
      The code developed on 2004 will work on 2004s.
    Some minor changes have been made refer to the documentation for specific details
    SAP NW2004s is the mySAP Business Suite edition of SAP NW 2004.it is a minor release that delivers on specific needs of the mySAP and xapps solutions delivered by SAP in 2005. the "s" stands for "mySAP Business Suite Edition".
    The next major release of NW will deliver on Business Process Platform(BPP) it will be released in 2006.
    Few of the New capabilities in NW2004s
    1)Developing a web based user interface with Web Dynpro fro ABAP.
    2)Enhancements to enabling B2B processes
    3)Enhancements to business task management
    4)Enhancements to business planning
    5)Enhancements to enterprise data warehousing
    6)mass setup of mobile devices
    7)implementing a global portal
    Refer the link for more info
    http://help.sap.com/saphelp_nw04s/helpdata/en/5b/8c3842bb58f83ae10000000a1550b0/frameset.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/57/a21f407b402402e10000000a1550b0/frameset.htm
    NW04 is a 'Java version' which means you can develop applications using Java and export them to portal.
    NW04s is a 'ABAP version'.Here you can develop ABAP reports and transactions and export them to portal. There you can create iViews using them.
    Netweaver 04s, includes both the ABAP and Java stacks. The Sneak preview for NW04s is only for the ABAP stack, and the Sneak Preview NW04 SP15 is only the java stack. If you are using the sneak preview for ABAP, you can develop WDA applications and BSP applications, they run directly in the engine, not in a portal. But they can be embeded in an iView in some portal. You don't have to have a portal to run your application. If you are using the java side, you can develop WDJ applications and JSP applications. Same applies here, they run on the java engine, not in a portal, but can be embeded into an iView which runs on the portal. But you don't need a portal for your application to run. The portal is just a frontend UI, the apps themselves run on the underlying engine, whether its ABAP or JAVA.
    Refer to the following threads for more information
    Re: What is NW04 s?
    Re: Differences between NW04 SP11 and NW04 SP15
    I hope this will help you
    Regards
    Suresh

  • What is the difference between Mobile Engine and MI?

    hi all,
    i want to know the difference between Mobile Engine and MI and also what are the main advantages included in MI instead of ME.

    Hi Anusha,
    ME had MicroITS as UI.
    MI has JSP and AWT as UI programming.
    From the above discussion its clear that JSP is the best option for programming.
    PS: AWT was depricated by SUNMicro.
    I just thought of sharing the history of MI.
    just to share to you a "history" of mobile projects in SAP.
    the current MI was actually a merged project from two mobile
    projects - the old Mobile Engine and the unheard Mobile
    Development Framework (MDF). when these projects were
    restructured, the ME was extended with some functionalities
    such as the SmartSync which was actually the replication
    technology used in MDF. MDF client was based on C++ and
    uses the CEDB as the database. it was not chosen to be
    the client due to its platform-dependency. MDF was already
    a working product when the restructuring happened. and there
    were some client functionalities like xml based GUI and
    metadata/logic definition that the current MI client doesn't
    have.
    Hope this is helpful.
    Close the thread if your done with your clarification.
    Cheers,
    Karthick

  • What is difference between sy-tabix and sy-index.

    SAP Seniors,
    Can you please let me know what is difference between sy-index and sy-tabix.
    I read the SAP help, it is confusing for me. it looks like both are same from help. please help me.
    Thank you
    Anitha.

    HI,
        Here is a brief description of difference between SY_TABIX and SY_INDEX and using them with several conditions.
    SY-TABIX
    Current line of an internal table. SY-TABIX is set by the statements below, but only for index tables. The field is either not set or is set to 0 for hashed tables.
    APPEND sets SY-TABIX to the index of the last line of the table, that is, it contains the overall number of entries in the table.
    COLLECT sets SY-TABIX to the index of the existing or inserted line in the table. If the table has the type HASHED TABLE, SY-TABIX is set to 0.
    LOOP AT sets SY-TABIX to the index of the current line at the beginning of each loop lass. At the end of the loop, SY-TABIX is reset to the value that it had before entering the loop. It is set to 0 if the table has the type HASHED TABLE.
    READ TABLE sets SY-TABIX to the index of the table line read. If you use a binary search, and the system does not find a line, SY-TABIX contains the total number of lines, or one more than the total number of lines. SY-INDEX is undefined if a linear search fails to return an entry.
    SEARCH <itab> FOR sets SY-TABIX to the index of the table line in which the search string is found.
    SY-INDEX
    In a DO or WHILE loop, SY-INDEX contains the number of loop passes including the current pass.
    Hope this helps.
    Thank you,
    Pavan.

Maybe you are looking for

  • My Credit card is on an account that i do not remember the email or password for

    I purchased Creative Cloud in 2012, as a student, and I used it for the past year+ but a few months my computer was factory reset, and I couldn't remember the email or password I used to get it. So now I am being charged every month for a product I c

  • Problem converting avi files to an ipod using quicktime

    when u load the video then say xport and it converts to a mp4 file but when i ;lay both the mp4 file and the avi file on quicktime there is no audio.

  • Search for text in PDF by VBA with only Adobe Reader installed

    My problem is widely known and frequenty posted, for instance: "Can anyone help me to open and search for a specific text string in a PDF document, return a true or false indicator (and nothing else)?" The answers mostly refer to and include   Set gA

  • Where can I buy the mSATA adapter for GT70?

    I have a GT70 0NC-494 which came with only a 750GB hard drive. I bought a SATA 3 SSD and i'm having lots of issues with it (like underspeed and unstability), so I want to install a super-raid adapter instead of a single SSD. thanks a lot

  • Alarm clock not working with external speakers

    I have a first generation iPod mini. I have some playlists - but cant get the alarm to work! it switches on for a second, but it comes on paused so you dont hear the music. Then it shuts off I am using external speakers, iBass, and i am wondering is