JSP include tag not showing page content

Below is my code for a JSP page that uses JSP:include tag to include footer.jsp. The footer page does not display on show_email_entry.jsp. The error I am getting is variable emailAddress cannot be resolved. What am I doing wrong?
Here is my code.
show_email_entry.jsp
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<%@ include file="../includes/header.htm" %>
<body>
<%
String firstName = request.getParameter("firstName");
String lastName = request.getParameter("lastName");
String emailAddress = request.getParameter("emailAddress");
%>
<h1>Thanks for joining our email list</h1>
<p>Here is the information that you entered:</p>
<table cellspacing="5" cellpadding="5" border="1">
<tr>
<td align="right">First name:</td>
<td><%= firstName %></td>
</tr>
<tr>
<td align="right">Last name:</td>
<td><%= lastName %></td>
</tr>
<tr>
<td align="right">Email address:</td>
<td><%= emailAddress %></td>
</tr>
</table>
<jsp:include page="footer.jsp" flush="true" />
<p>To enter another email address, click on the Back <br>
button in your browser or the Return button shown <br>
below.</p>
<form action="../email6/join_email_list.html" method="post">
<input type="submit" value="Return">
</form>
</body>
</html>
FOOTER.JSP page:
<%@ page import="java.util.Date" %>
<p><i><%= emailAddress %> was added on <%= new Date() %>.</p>

The [url http://java.sun.com/products/jsp/syntax/2.0/syntaxref209.html#1003408]@include directive and the [url http://java.sun.com/products/jsp/syntax/2.0/syntaxref2020.html#8828]<jsp:include> have two different functionalities.
From the [url http://java.sun.com/products/jsp/syntax/2.0/syntaxref20.html] reference page:
Include Directive : Includes a resource of text or code when the JSP page is translated.
<jsp:include>
Includes a static resource or the result from another web component
(italic emphasis is mine)
Basically the @include directive is like "copy and paste this file into the JSP and then compile"
jsp:include is "run this web page, and add the result of that to my current response"
So jsp:include can only include complete standalone JSPs.
Do you see now why it would throw an error message with your example?
Cheers,
evnafets

Similar Messages

  • Jsp include can not show the full page

    When i use jsp to include other jsp which have around 1000 lines. the included jsu can only show the last 500 lines. how can i solve lt?

    Having JSPs of this size is very bad practice. You should design your solution so as to avoid this at all costs.
    There is an upper size limit on JSPs which you may be running into here, check the JSP spec but it's something like 64k
    Regards,
    Gareth
    (PDK team)

  • Jsp:include tag does not preserve encoding of the text

    hi
    I am using Apache web server and Tomcat 4.1.
    I have a jsp:include tag (in say test1.jsp) and I am trying to include a data1.html file. This html file contains UTF-8 encoded text. When this JSP is executed, the UTF-8 text is displayed as garbage characters.
    I have included following in the JSP
    <%@ page contentType="text/html; charset=UTF-8" %>
    I have included following in the info.html
    <meta HTTP-EQUIV="content-type" CONTENT="text/html; charset=UTF-8">
    However if I rename the info.html to data1.jsp and then include, the UTF-8 text gets displayed correctly.
    I suppose, the JSP engine does not interprete the content of the html file correctly according to its encoding.
    Where as if it is a .jsp, then it is int erpreting it appropriately?
    Can anybody throw some lite on this?
    regards
    haresh
    sample files.......
    test1.jsp..........
    <%@ page contentType="text/html; charset=UTF-8" %>
    <%
    response.setContentType("text/html; charset=UTF-8");
    %>
    <HTML>
    <HEAD>
    <meta HTTP-EQUIV="content-type" CONTENT="text/html; charset=UTF-8">
    </HEAD>
    <BODY>
    <jsp:include page="data1.html" flush="true"/>
    </BODY>
    </HTML>
    data1.html.....
    <meta HTTP-EQUIV="content-type" CONTENT="text/html; charset=UTF-8">
    <br>
    &#2361;&#2366;&#2340;&#2368; &#2328;&#2381;&#2351;&#2366;&#2354; &#2340;&#2375; &#2340;&#2337;&#2368;&#2360; &#2344;&#2381;&#2351;&#2366;.
    <br>

    Your generated HTML will be flawed.
    The output of the included JSP is included in the outputstream of the enclosing one.
    Browsers will normally skip any illegal tags when encountered. This included your complete html headers from the included jsp and may (depending on the browser) include all code after the html close tag from that jsp.
    Stricter browsers may simply refuse to display anything at all.
    Read up on what the include mechanism exactly does and on wellformed HTML.

  • Problem with flush=true in the jsp:include tag

    Hello
    I have deployed a JSP based application , based on the apache struts framework. The web server is Sun One Webserver 6 Service Pack4, on a windows 2000 machine
    The same application was tried on SunONE application server 7, and it works without any problem. However in this case the following error , on the page
    javax:servlet.jspexception:Illegal to flush within a custom tag
    Does this mean flush="true" is not allowed within custom tags
    Or is there a workaround for this
    Any help is appreciated
    thanks
    - Aniruddha

    Hi,
    This is a known problem, ��flush before you include�� limitation in JSP 1.1.
    As a result, you have to state flush="true" every time you include a jsp using <jsp:include> tag if you are using JSP1.1.
    Fortunately, it is fixed in JSP1.2. The flush attribute controls flushing. If true, then, if the page output is buffered and the flush attribute is given a ��true�� value, then the buffer is flushed prior to the inclusion, otherwise the buffer is not flushed. The default value for the flush attribute is ��false��.
    Gary Wang
    Developer Technical Support
    SUN Microsystems
    http://www.sun.com/developers/support/

  • Scriptlet within a jsp:include tag

    In Jrun 2.3.3 you could include a scriptlet within a <jsp:include> tag like this:
    <%
    String language = "E";
    %>
    <jsp:include page="/Conditions<%= language %>.html"/>
    Since I have to programme for four languages on our site, I used this convenient way of including different language pages on the fly all over the site.
    I then had a problem with 2.3.3 so I got 2.3.8 and discovered that all of these jsp:includes with scriptlets didn't work any more.
    I hastily uninstalled 2.3.8 and have continued with 2.3.3 ever since, thinking that they would sort this out in 3.0., which they didn't.
    Presumably to deal with this when I want to upgrade JRun I will have to use a load of if{} statements instead, but for four languages I will need four if {} statements which is incredibly long-winded compared to the single line of code above.
    <%
    if(language.equals("E")){
    %>
    <jsp:include page="/ConditionsE.html"/>
    <%
    %>
    Can anybody help:
    1) by giving me a neater solution that the one I've come up with.
    2) by explaining what happened at JRun to cause this change.
    Thanks.

    I could be wrong, but at least with WSAD (WebSphere), I couldn't do this:
    <html:text maxlength="14" size="10" property="proofOfClaim[<%=memberAccountIndex%>].sentDate%>"/>
    but could do this:
    <% String property = "proofOfClaim[" + memberAccountIndex +"].sentDate"; %>
    <html:text maxlength="14" size="10" property="<%=property%>%>"/>
    I think the reason is that since <html:text> is a custom tag, any scriptlets <%=...%> must be the ENTIRE value, and not be inserted in the middle of a value, for an attribute. Try it out. :)

  • Flush in the jsp:include tag

    should I state flush="true" every time I include a jsp using <jsp:include> tag in a jsp pages? For example I am trying to include a menu bar on the top of every jsp pages. Should I flush the buffer every time? if not, will it affect the performance?
    Thank you
    Cal

    Hi,
    This is a known problem, ��flush before you include�� limitation in JSP 1.1.
    As a result, you have to state flush="true" every time you include a jsp using <jsp:include> tag if you are using JSP1.1.
    Fortunately, it is fixed in JSP1.2. The flush attribute controls flushing. If true, then, if the page output is buffered and the flush attribute is given a ��true�� value, then the buffer is flushed prior to the inclusion, otherwise the buffer is not flushed. The default value for the flush attribute is ��false��.
    Gary Wang
    Developer Technical Support
    SUN Microsystems
    http://www.sun.com/developers/support/

  • Jsp include tag 1.1

    Hi all,
    i am getting the following error if my code snippet has a <jsp:include> tag
    org.apache.jasper.JasperException: Invalid jsp:include tag
    i am using VAJ3.5.3 and i modified the hosts file to support jsp1.1.
    But when i change to jsp1.0 the code works fine and fetching me the page contents.
    Need inputs.
    Regards
    Ramesh Kesavanarayanan

    Hi kesavramesh,
    I think some time ago, you're looking for something like this
    - Can I use jsp includes inside the taglib ?-
    See point 1 and 2.
    -- Paul
    1. link:
    http://www.jguru.com/faq/view.jsp?EID=115446
    2. text from the link:
    Normally when you call one JSP page from another you have no significant access to the result of the called JSP. So if I have
    Hi, I like nice clean JSP output
    <jsp:include page="gobbledegook.jsp" flush="true"/>
    Doh!
    When it would be much nicer to be able to do this:
    <%@ taglib uri="blahblah" prefix="myTags"%>
    Hi, I like nice clean JSP output
    <myTags:cleanUp>
    <jsp:include page="gobbledegook.jsp" flush="true"/>
    </myTags:cleanUp>
    Wahoo!
    This can be accomplish with the tag class:
    public class TakeOutTheTrashTag extends BodyTagSupport
    public int doStartTag() throws JspTagException
    return EVAL_BODY_TAG;
    public int doAfterBody() throws JspTagException
    try {
    if (bodyContent != null) {
    String messy = bodyContent.getString();
    String clean = takeOutTheTrash(messy);
    bodyContent.getEnclosingWriter().print(clean);
    } catch (IOException ie) {}
    return EVAL_PAGE;
    public int doEndTag() throws JspTagException
    return EVAL_PAGE;
    private String takeOutTheTrash(String messy)
    String cleanedUp = messy;
    return cleanedUp;

  • Portlet repository-- Seeded providers does not show Portal Content area

    Hi,
    When I login to portal as admin user go to administration --> Display portlet repository--> Seeded providers does not show Portal Content area.I tried to search but no results shown.
    Any idea as to how to get it back ?
    Thanks and regards.
    Neeti.

    1. From the Portal Object Navigator, click on the Applications
    tab.
    2. In the "Find" box, type %search% and click "Go"
    3. There are 2 reports you need to modify, depending on which
    portlet provider you want to use: RPT_SEARCH (owned by
    people_app) and SEARCH_RESULT (owned by wwv_system)
    4. For each report, click the "Edit" link
    5. Click the "Display Options" tab
    6. Under the "Full Page Options" heading, change the "Size"
    for "Row Text" to 12. (If you are running the reports as
    portlets, then you must also change the "Size" for "Row Text"
    under "Portlet Options".)
    7. Click OK
    Search results are now visble using either portlet, the Oracle
    Portal provider or the PEOPLE_APP provider.
    You may also need to change the field settings on the hierarchy
    if now when you run the people search you receive SQL errors.
    Here is what worked for me (assuming you want to change both
    users components):
    1. On the Application Tab search for %search% and %detail%
    components. You don't need to change the WWMON components.
    Change the font size on the full page and portlet options
    (Display Options Tab)for the heading and text (I use 12 and
    11pt). Otherwise the default can only be read with a magnifying
    glass.
    2. The org chart components are slightly different. Search for %
    org% and you will find 2 components org_chart and orgchart. Both
    of these need to have the column fields changed (Table or View
    Column tab) as well as the font size for the Parent, Child,
    Grandchild (Display Options Tab). Here are the Table Column
    settings (for some reason they are initially blank - yet will
    fail if recompiled without values):
    People_App.Org_chart
    1. key values:
    primary key - empno
    parent key - manager
    start with - empno
    ww_system.orgchart
    1. Primary Key Column WWSEC_PUBLIC_DIRECTORY.ID
    Parent Key Column WWSEC_PUBLIC_DIRECTORY.MANAGER
    Start With Column WWSEC_PUBLIC_DIRECTORY.ID
    Hope this helps. The second half of the answer provided by Rich
    Pickett.

  • How to not show pages in the Site Map

    This is probably the easiest question of them all... but...
    How do you not show pages in the site map?
    It seems that by default, all pages are added to the sitemap.
    Is it a case of unchecking "enabled" and checking "exclude from search results" under "More Options" on the page itself?
    Or another way?

    Hi David,
    The "exclude from search result" will remove from the sitemap.xml "yoursite.com/sitemap.xml" and from major search engines from being picked up.  If you tick this option please allow for a few hours to have the xml to reflect the changes.
    "If you select this option then this web page will be excluded from the site search feature built into this system as well as from the sitemap.xml file submitted to the major search engines such as Google, Yahoo and Live."
    The sitemap module found under site settings is not related to the xml file so you'll need to manually remove and insert onto your page if using this feature.
    - http://kb.worldsecuresystems.com/kb/add-sitemap.html
    Hope this clarifies.
    -Sidney

  • Can I write Design-time for JSP custom tag(not JSF components)

    I have some old JSP custom tags(not JSF components), and I want to use them in the IDE through the toolbox.
    Now I have already written the BeanInfos for these tags, and they can be drag from the toolbox; but it will throw a Exception when render the tags, and the properties in the Property Editor are not which I describe in the BeanInfos.
    How can I write Design-time for these tags? or whether it is possible to write the Design-time for these tags?
    the Exception is shown as follow:
    java.lang.ClassCastException
         at com.sun.rave.insync.faces.FacesPageUnit.renderNode(FacesPageUnit.java:1347)
    [catch] at com.sun.rave.insync.faces.FacesPageUnit.renderBean(FacesPageUnit.java:1086)
         at com.sun.rave.insync.faces.FacesPageUnit.getFacesRenderTree(FacesPageUnit.java:993)
         at com.sun.rave.css2.FacesSupport.getFacesHtml(FacesSupport.java:152)
         at com.sun.rave.css2.CssContainerBox.addNode(CssContainerBox.java:373)
         at com.sun.rave.css2.CssContainerBox.createChildren(CssContainerBox.java:354)
         at com.sun.rave.css2.DocumentBox.createChildren(DocumentBox.java:90)
         at com.sun.rave.css2.DocumentBox.relayout(DocumentBox.java:160)
         at com.sun.rave.css2.PageBox.layout(PageBox.java:392)
         at com.sun.rave.css2.PageBox.relayout(PageBox.java:454)
         at com.sun.rave.css2.DocumentBox.redoLayout(DocumentBox.java:313)
         at com.sun.rave.css2.PageBox.redoLayout(PageBox.java:460)
         at com.sun.rave.css2.DocumentBox.changed(DocumentBox.java:634)
         at com.sun.rave.designer.DesignerPaneUI$UpdateHandler.changedUpdate(DesignerPaneUI.java:1012)
         at com.sun.rave.text.Document.fireChangedUpdate(Document.java:851)
         at com.sun.rave.text.Document$5.run(Document.java:631)
         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

    I have some old JSP custom tags(not JSF components), and I want to use them in the IDE through the toolbox.
    Now I have already written the BeanInfos for these tags, and they can be drag from the toolbox; but it will throw a Exception when render the tags, and the properties in the Property Editor are not which I describe in the BeanInfos.
    How can I write Design-time for these tags? or whether it is possible to write the Design-time for these tags?
    the Exception is shown as follow:
    java.lang.ClassCastException
         at com.sun.rave.insync.faces.FacesPageUnit.renderNode(FacesPageUnit.java:1347)
    [catch] at com.sun.rave.insync.faces.FacesPageUnit.renderBean(FacesPageUnit.java:1086)
         at com.sun.rave.insync.faces.FacesPageUnit.getFacesRenderTree(FacesPageUnit.java:993)
         at com.sun.rave.css2.FacesSupport.getFacesHtml(FacesSupport.java:152)
         at com.sun.rave.css2.CssContainerBox.addNode(CssContainerBox.java:373)
         at com.sun.rave.css2.CssContainerBox.createChildren(CssContainerBox.java:354)
         at com.sun.rave.css2.DocumentBox.createChildren(DocumentBox.java:90)
         at com.sun.rave.css2.DocumentBox.relayout(DocumentBox.java:160)
         at com.sun.rave.css2.PageBox.layout(PageBox.java:392)
         at com.sun.rave.css2.PageBox.relayout(PageBox.java:454)
         at com.sun.rave.css2.DocumentBox.redoLayout(DocumentBox.java:313)
         at com.sun.rave.css2.PageBox.redoLayout(PageBox.java:460)
         at com.sun.rave.css2.DocumentBox.changed(DocumentBox.java:634)
         at com.sun.rave.designer.DesignerPaneUI$UpdateHandler.changedUpdate(DesignerPaneUI.java:1012)
         at com.sun.rave.text.Document.fireChangedUpdate(Document.java:851)
         at com.sun.rave.text.Document$5.run(Document.java:631)
         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

  • Why is Safari not showing pages correctly ?

    Hi there !
    I'm having a little Safari 5 trouble.
    Safari is not showing page layouts correctly, it seems it is not recognizing / reading css at all. Not one site shows correctly !
    Whereas Firefox has no problem at all.
    On Safari, I had diverse small extensions and Glims (but I had those for a while and nothing like this ever happened - only the occasional crash).
    Also, I tried reinstalling Safari entirely. No change.
    What do you think can be causing this ?

    HI and welcome.......
    If you still have Glims the latest build is available here.
    http://wiki.machangout.com/howdoi/glims-development-build
    As for the extensions, go to Safari / Preferences - Extensions. Turn that OFF. Quit Safari (Command + Q) Relaunch Safari and see if that makes a difference.
    Try resetting Safari. From your Safari menu bar click Safari / Reset Safari. Select the top 7 buttons, click Reset.
    If nothing above has helped, try troubleshooting the Safari .plist file. Open a Finder window. Select your Home Folder in the Sidebar on the left. It has a small house icon. Then open the Library folder then the Preferences folder.
    Move the com.apple.Safari.plist file from the Preferences folder to the Desktop. Now launch Safari. If Safari loads pages as it should, move that .plist file to the Trash.
    Carolyn

  • Imac not showing the contents of my classic iPod and iPad when i connect them to the iMac?

    imac not showing the contents of my ipod classic and ipad when i connect them to my imac?

    That's not much to go on.
    What operating system and version are you using? Are you using the most recent version of iTunes? If so, did you update prior to this happening? What other changes might have triggered this? What troubleshooting have you done already and what was the result?

  • Icloud in mac safari not showing pages open on other divices

    icloud in mac safari not showing pages open on other divices...
    PLs help

    Are the other devices connected to icloud and is Safari turned on in Settings>icloud?

  • Adding PHP pages, not showing dynamic content?

    Hi all,
    I'm new and hoping I don't get ripped apart for a question that seems simple. I've looked a lot though and can't seem to find an exact scenario like this. I recently took over a PHP site for a friend that was built in Dreamweaver CS3.
    There's a master page (main.php) that includes a header and footer and middle area of dynamic content. Thus, all of the pages appear like: http://www.SITENAME.com/main.php?mod=about (for the 'about' page) or www.SITENAME.com/main.php?mod=welcome (for the landing/home page), etc.
    In main.php, there's a section of: // Include Multiple Static Pages that looks like this:
    $mxiObj->IncludeStatic("about", "about.php");
    for every static page.
    All of this makes sense to me. Here's my problem:
    When adding a new page now, I can't get it to show any of the dynamic content on the live site. I just get the static header and footer to show.
    In the main.php file, there's this section:
    </div>
      <div id="mainContent">
        <p> 
          <?php
      $incFileName = $mxiObj->getCurrentInclude();
      if ($incFileName !== null)  {
        mxi_includes_start($incFileName);
        require(basename($incFileName)); // require the page content
        mxi_includes_end();
    ?></p>
    </div>
    that's supposed to pull in the dynamic content. It's doing this just fine on the older pages, but not on the ones I'm trying to build now.
    I guess I'm asking if there's some type of file in an 'includes' folder that I'm missing where I need to make sure the FileName is also listed (not just in the static section on main.php)? What's the mising link that will get this dynamic content to show up?
    Thanks for any help in advance and for reading this!

    The quickest way to add new pages is to
    copy the template (index.php) to a new document (newdoc.php or similar)
    remove the PHP stuff - stuff that is not required for the new content
    if there are inludes for the menu, header, footer or similar, then you can link those back into the document using standard includes
    add the new content to the newly created document
    This will give you a stand-alone document. At a later stage you can convert these documents into a DW-template system.

  • Using Content Query webpart for specific Document library with multiple managed metadata - Document with multiple metadata tags not showing up

    Hi,
    I am having an issue where when I insert a Content Query webpart into a page, and filter to managed metadata, all the right documents show up except one document that happens to have two metadata tags attached to it.  The content query webpart is set
    to only look through a specific document library.  I'm not sure what I am doing wrong.
    Here is the one document with two metadata tags:
    Below is the Content Query:

    Hi,
    As I understand, you did not get the results with multiple metadata tags through Content Query web part in SharePoint 2013.
    Check things below:
    1. Check if you have set the item limit more than the display items in Presentation section of the web part. If the item number more than item limit, the rest items will not show.
    2. Check if the item you cannot find uses the content type you have set in the content type section of content query web part.
    When you edit the properties of the item, you will see the content type the item is using.
    Best regards
    Sara Fan
    TechNet Community Support

Maybe you are looking for