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;

Similar Messages

  • 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 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.

  • 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

  • [JSP/Newbie]: howto write my own jsp:include tag?

    Hi folks,
    I'm trying to write a replacement tag for <jsp:include> (which shall later decide upon its context what to include..), i.e. I want to include another JSP from within a tag.
    Unfortunately right now my best bet does not allow to control the position of the included JSPs output in my output stream - it prints directly :-((
    // index.jsp is my startpage:
    <%@ taglib uri="/cistags" prefix="cis" %>
    index.jsp START:
    <cis:include file="/theincludefile.jsp" />
    index.jsp ENDE
    // theincludefile.jsp is the included file
    -->INCLUDEFILE<--
    // include.java is my current idea to approach this:
    public class include extends TagSupport {
    private String jspName;
    public void setFile(String name) {
    this.jspName = name;
    public int doEndTag() {
    HttpServletRequest request =
    (HttpServletRequest) pageContext.getRequest() ;
    HttpServletResponse response =
    (HttpServletResponse) pageContext.getResponse() ;
    try {
    request.getRequestDispatcher(
    response.encodeURL(jspName)).include(request,response) ;
    catch (Exception e) { }
    return EVAL_PAGE;
    the result expected is:
    index.jsp START:
    -->INCLUDEFILE<--
    index.jsp ENDE
    but instead I receive:
    -->INCLUDEFILE<--
    index.jsp START:
    index.jsp ENDE
    So how can I get hold of the ouput generated by the JSP I'm calling through RequestDispatcher.include so that I can rewrite it into my own output stream here?
    Is someone out there able to point me into the right direction?
    Ingo
    [email protected]

    check this article out
    http://www.javaworld.com/javaworld/jw-09-2000/jw-0915-jspweb.html

  • Jsp include tag giving exception in Jboss

    Hi,
    I have a jsp page with the include tag
    <jsp:include name="w.jsp" />
    When the jsp is compiled in Jboss 3 its givin an exception as
    \Temp\Jetty_0_0_0_0_7001__blsapp\jsp\agent\A_jsp.java:220: cannot resolve symbol [javac] symbol : method include (javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,java.lang.String,javax.servlet.jsp.JspWriter,boolean) [javac] location: class org.apache.jasper.runtime.JspRuntimeLibrary [javac] JspRuntimeLibrary.include(request, response, "w.jsp", out, false);
    Have any one come across this error pls help me in solving this

    check ur sytnax dear its page not name

  • Unable to run jsp as include using jsp:include tag

    I am trying to run the basic jsp:include sample provided by Oracle in OC4J 10g. When I run the code, It seems like include file is treated as text/html and not run at all. Can somebody help me in figuring out what I am missing here..
    Here is the code for main.jsp
    <jsp:include page="content.jsp">
    <jsp:param name="a" value="1"/>
    <jsp:param name="b" value="2"/>
    <jsp:param name="c" value="3"/>
    </jsp:include>
    Here is the code for content.jsp
    <p> Included Content </p>
    <p> Parameters - ${param.a}, ${param.b}, ${param.c} </p>
    When I run this code in JDeveloper10g using the embedded OC4J as well as Application Server 10g, I get the following output.
    Included Content
    Parameters - ${param.a}, ${param.b}, ${param.c}
    Note that the parameter values are not substituted properly.
    Thanks in advance
    Niraj

    javax.servlet.ServletException: com/sun/tools/javac/Main (Unsupported major.minor version 49.0)
    This is your problem either your tomcat or eclipse is pointing to a wrong jre
    here the problem is you are trying to run a code that was compiled using j2sdk1.5 in j2sdk1.4

  • How to do a jsp:include inside a noscript tag??

    I am new to JSP and I need help to do a <jsp:include page="pageName" /> inside a <noscript> tag. My goal is to include another jsp if the user has javascript disabled on its browser.
    I am using a JSP template that retrieves content from the Database, so I need to pass a parameter also, like:
    <noscript>
    <jsp:include page="/include/template.jsp" flush="true"/>
         <jsp:param name="pageName" value="holidays_onboard_html"/>
    </noscript>
    My code doesn't seem to work. I found an explanation that says that the noscript tag is interpreted after the servlet already tried to compose the original page, so I can't use a <jsp:include> tag inside the noscript tag. Is it true? Is there any other solution for what I am trying to accomplish?
    Thanks a lot!

    Java indeed runs at the server side, not at the client side. Java runs at the server side and produces a HTML page. HTML only runs at the client side.
    The <noscript> tag is not a Java/JSP tag, it is a HTML tag. What you want is only possible when you checked in Java if the client has JS enabled, e.g. using a request parameter, or by loading the page template using a HTML tag, e.g. <iframe>.

  • JSTL core tags not working inside of a jsp:include?

    I have declared the core JSTL tag and have a jsp include tag that calls another jsp page. I want to be able to execute a c:if statement inside the included file, but the c:if statement does not execute and is read back to me within the html. This is a frustrating problem because the EL returns a true or false based on the param I sent, but the c:if does not run.
    Is there a way to fix this, or is this something that I can't change?
    Note: I have found a workaround by using the include directive. I would rather use the jsp:include action, but unless this problem gets solved I will be sticking with the directive.
    Thanks
    Message was edited by:
    nberveiler

    You need to have the Core taglib declared on the page that you are including with jsp:include.
    There is a subtle difference between the include directive <%@ include %> and <jsp:include>
    The latter happens at runtime, and includes the result of running the included page.
    Therefore any page included with <jsp:include> needs to be completely standalone, and declare all of its own taglibraries that it uses. It can't inherit them from the "including" jsp.
    The include directive works, because it pastes in the contents of the included file at compile time - effectively making one big JSP file.
    Cheers,
    evnafets

  • Using jsp:include in jsf

    I want to include a jsp page in another jsp page. My code is as follows:
    1)
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:c="http://java.sun.com/jstl/core"
    version="2.0">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Page Title</title>
    </head>
    <body>
    <f:subview id="sub">
    <jsp:include page="/demo.jsp"/>
    </f:subview>
    </body>
    </html>
    </jsp:root>
    2) demo.jsp is given below
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:c="http://java.sun.com/jstl/core"
    version="2.0">
    <ui:composition>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Page Title</title>
    </head>
    <body>
    <h:outputText value="Hello"/>
    </body>
    </html>
    </ui:composition>
    </jsp:root>
    but when i run this application i get error as follows:
    javax.servlet.ServletException: @15,48 <jsp:include> Tag Library supports namespace: http://java.sun.com/JSP/Page, but no tag was defined for name: include
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:270)
         org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
         org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
         org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:390)
         org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:517)

    You're mixing two view technologies with each other: JSP and Facelets. You cannot do that. Use the one or the other. In Facelets you can just use <ui:include>. Leave all of those legacy <jsp> tags out when using Facelets.
    By the way, although the <f:subview> is superfluous in Facelets and only used in JSP, I wanted to tell you, this tag is better to be placed in the include file, not in the parent file. Otherwise you may risk "duplicate component ID" problems.

  • Using jsp:include in showOneTab - main form not loaded on submit

    I have a JSP page with JSF and ADF components. It is a large JSP containing some main details and then an af:showOneTab component to create a set of tabs. It works fine with JDK 1.5 and Tomcat 5.0 but when changed to Oracle Application Server 9.0.4 and JDK 1.3 We get the following error:
    JspCompileException:.... code too large for try statement catch( Throwable e}....
    Finding this to be caused by large size of JSP, we divided the page as follows - a main jsp containing the main form details and 1 jsp for each tab. Whenever one of the tabs is clicked the corresponding JSP is dynamically loaded using jsp:include tag as follows:
    <af:showDetailItem text="Tab1" id="tab1" styleClass="menu">
              <f:subview id="viewTab1">
                   <jsp:include page="Tab1.jsp" />
              </f:subview>
    </af:showDetailItem>
    There is a Submit button in the main jsp, when this is clicked the main jsp is reloaded.
    But when the user navigates to any of the tabs and then clicks the Submit button in the main form, the main form is not reloaded - only the jsp for the currently selected tab is loaded.
    (I am using f:view and h:form in the main form, and no form tag in the included jsps)
    How to solve this problem?

    The af:selectOneChoice components are in the test.jsp page included in main.jsp with jsp:include tag.
    The code look like this:
                   <af:selectOneChoice label="#{msg.team}"
    id="soc1"
    value="#{myBean.selectedTeamID}"
    autoSubmit="true">
    <f:selectItems id="si1" value="#{myBean.teamList}"/>
    </af:selectOneChoice>
    <af:selectOneChoice label="#{msg.subteam}"
    id="soc2"
    value="#{myBean.selectedSubteamID}"
    partialTriggers="soc1"
    rendered="#{myBean.selectedTeamID!=null}"
    autoSubmit="true">
    <f:selectItems id="si2" value="#{myBean.subteamList}"/>
    </af:selectOneChoice>
    the code works fine in the seperate page, but when I include the page the second selectOneChoice component doesnt get rendered.
    Edited by: Migan on 2010-jul-13 08:36

  • Relatiive Path problem when using JSP:include in web portlet

    Hi
    I am using Oracle Portal 9.0.2, and thus OC4J as the J2EE platform.
    I have created a JSP web portlet that is supposed to inlude a specific static html file, which name is passed to it using a portlet parameter. It works, but I had to create a symbolic link from the applicable J2EE applications's htdocs directory in order to access the content:
    /j2ee/OC4J_Portal/applications/<application>/htdocs/<portlet>/content/
    where /content/ is a symbolic link to another directory altogether.
    I can then access the content from within the portlet with a JSP include tag that looks like :
    docPath = "/htdocs/<portlet>/html/"+doc_path;
    %>
    <br>Include:
    <jsp:include page="<%=docPath%>" flush="true"/>
    I would like to access the content using the JSP include without having to use the symbolic link. Is there a way to do this. I tried using an Apache alias, but that did not work.
    Regards
    Harry

    Hi
    Thanx
    In the end we build up a static URL to the document to be included using:
    String contentLocation="content/";
    docPath = contentLocation+getAdditionalDocPath();;
    out.println("docPath="+docPath);
    String docPathAndName = portletRequest.getParameter("doc_path");
    %>
    <!--
    This java script function calls the display content page with the
    page parameter doc_path (which is in return passes it to the display
    content portlet) in order to retrieve and display specific document
    with a JSP:include tag
    -->
    <script language="JavaScript">
    function generateSectionPath(docName) {
    this.location="http://<%=portletRequest.getServerName()%>:<%=portletRequest.getServerPort()%>/pls/portal/url/page/<%=getPageGroup()%>/content?doc_path="+"<%=docPath%>"+docName;
    <script language="JavaScript">
    function generateRelativePath(docName) {
    this.location="http://<%=portletRequest.getServerName()%>:<%=portletRequest.getServerPort()%>/pls/portal/url/page/<%=getPageGroup()%>/content?doc_path="+docName;
    </script>
    <br>Include:
    <%
    if (portletRequest.getParameter("doc_path") == null) {
    out.println("Error - no doc path specified");
    } else { 
    try { %>
    <jsp:include page="<%=docPathAndName%>" flush="true"/>
    <% } catch (Exception e) {
    out.println("Error retrieving document:"+e.toString());
    } // end if
    %>
    Each link from one included HTML file to another becomes a JS function that points the browser to the portal page that includes the portlet that includes thwe JSP that has the include tag to include the html document that is to be displayed.
    The current relative path the the html document (from a predefined root in the file system that is symbolically linked to the same directory as where the including JSP lives) is stored in a session variable, and appended to the document name that is passed to the page.
    If a full document path, as opposed to just the name, is stored, that no appending is done. However, the path is stripped out and stored in a session variable.
    Ths thing is, sometimes a document name, and sometimes a path is passed to the page. Therefore the requirement to know the path when it is not available. A name only will always be passed subsequent to a request for a document with the full path specified, therefore the session variable mechanism works.
    Thanx for the input
    Harry

  • Using variables in jsp:include

    Hello,
    I'm still working wih the JSP 1.2 specs and I want to use a variable in my jsp:include.
    For example <jsp:incude page="${vUrl}/>
    Where vUrl is defined as
    <c:url value="/doesnotmatter" var="vUrl"/>
    Something like that ...
    I also tried to nest a <c:out> withing my <jsp:include> tag but without success.
    Thanks in advance ...

    u can do it like this:
    <jsp:include flush="true" page='<%=path%>' />

Maybe you are looking for

  • HP Officejet Pro 8500A Used to print now I have to reinstall everyday

    I have a HP Officejet Pro 8500A Plus e-All-in-One Printer - A910g that used to work beautifully. My computer hung one day and I had to hard restart it (kill the power after it was frozen for 10 minutes) . Since then I have to uninstall the HP printer

  • URGENT - How Do I get RAB info in SQL

    Hi, I need some urgent help on getting the log information for OWB mapping jobs that is viewed in the Runtime Audit Browser from SQLplus. I dont have the abiltiy to use the RAB over RAS at 2am in the wee hours, and I really need to know how to get th

  • Code 110 Reason Error in HTTP Receiver adapter

    Hello I am having proxy to HTTP Receiver scenario in which i am calling the target application URL through HTTP Receiver Adapter. This interface is async interface and hence i am not expecting any response from the target system. When i execute my in

  • Mac CS5: Why is Illustrator screen redraw so slow?

    I'm using an 8-core Mac Pro and 10.6.4.  Why does it take almost 1 second for the Illustrator window to redraw when the window is resized?  It should be immediate, especially when there's not even a lot of graphics.  The same goes for zooming in and

  • Error while establishing grid in Financial Reporting

    I am getting an error when I login into Financial Reporting studio and try to build a new report I am not able to add a new grid as it throws following errror: DatasourceIDLogin.LoadDatasourceNames Error: -2147467259 Error Loading DatasourceList to R