NetWeaver EE 5 jsp include action issue

Under NetWeaver EE 5 trial version I encounter the following problem:
page buffer is always flushed before jsp:include.
By default flush must default to "false", but either I specify flush="false" or miss the attribute - the buffer is always flushed.
Also the reason is not in buffer size - I make it large enough but the issue remains.

A.jsp says <jsp:include page="dir/B.jsp"/> and dir/B.jsp says <%@include file="C.jsp" %>. In this case the relative specification C.jsp resolves to dir/C.jsp.
In this case the jsp:include is the equivilent of a RequestDispatcher.include. This can be view as the request being passed on to dir/B.jsp which will act on th erequest as if it came from a browser. the dir/B.jso then resloves all relative urls based on it's location in the dir directory. This is runtime binding.
A.jsp says <%@include file="dir/B.jsp" %> and dir/B.jsp says <jsp:include page="C.jsp" />. In this case the relative specification C.jsp resolves to C.jsp."
This is an example of compile time binding. When the servlet container translates A.jsp into sevlet code it includes the code from dir/B.jsp into A.jsp's servlet code. When you reach the include of C.jsp it is inside the servlet code of A.jsp and is resolved based on the location of A.jsp.

Similar Messages

  • OK.. ha ha funny. But really does ojsp really support jsp:include ?

    I've been reading this list for a month or so now and still have a nagging question.
    Has anyone gotten ojsp to work using an include of the form: <jsp:include page="/somefile.jsp" />?
    According to the Oracle JSP team you should be able to use it:
    <% request.setAttribute("show","script"); %>
    <jsp:include page="/search_navigation.jsp"/>
    [/CODE\
    Similar to the IBM Websphere example.
    <HR></BLOCKQUOTE>
    This sounds nice, but first the syntax above is missing the flush modifier (which ojsp requires to be set to "true"), second the server gives the error:
    A Servlet Error Occurred
    An unexpected error occured attempting to run this servlet.
    The most likely explanation is a problem with the servlet code.
    Please check the server log for a detailed message.
    So can anyone use the <jsp:include> action in ojsp (the current one on OTN)?
    Thanks in advance.

    Thanks for your reply. Answers below:
    <jsp:directive.page language="java" />
    <jsp:include page="/arena/pages/login.jsp" flush="true" />
    <html>
    <body>
    Hello there.
    </body>
    </html>Generates this code:
    package jsptest;
    import oracle.jsp.runtime.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import javax.servlet.jsp.*;
    import java.io.*;
    import java.util.*;
    import java.lang.reflect.*;
    import java.beans.*;
    public class test1 extends oracle.jsp.runtime.HttpJsp {
    public final String _globalsClassName = null;
    // ** Begin Declarations
    // ** End Declarations
    public void _jspService(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
    /* set up the intrinsic variables using the pageContext goober:
    ** session = HttpSession
    ** application = ServletContext
    ** out = JspWriter
    ** page = this
    ** config = ServletConfig
    ** all session/app beans declared in globals.jsa
    JspFactory factory = JspFactory.getDefaultFactory();
    PageContext pageContext = factory.getPageContext( this, request, response, null, true, JspWriter.DEFAULT_BUFFER, true);
    // Note: this is not emitted if the session directive == false
    HttpSession session = pageContext.getSession();
    if (pageContext.getAttribute(OracleJspRuntime.JSP_REQUEST_REDIRECTED, PageContext.REQUEST_SCOPE) != null) {
    pageContext.setAttribute(OracleJspRuntime.JSP_PAGE_DONTNOTIFY, "true", PageContext.PAGE_SCOPE);
    factory.releasePageContext(pageContext);
    return;
    ServletContext application = pageContext.getServletContext();
    JspWriter out = pageContext.getOut();
    test1 page = this;
    ServletConfig config = pageContext.getServletConfig();
    try {
    // global beans
    // end global beans
    out.println( "");
    out.println( "");
    String __url = (String) "/arena/pages/login.jsp";
    // Include
    out.flush();
    pageContext.include( __url);
    if (pageContext.getAttribute(OracleJspRuntime.JSP_REQUEST_REDIRECTED, PageContext.REQUEST_SCOPE) != null) return;
    out.println( "");
    out.println( "");
    out.println( "<html>");
    out.println( "<body>");
    out.println( "Hello there.");
    out.println( "</body>");
    out.println( "</html>");
    out.flush();
    catch( Exception e) {
    try {
    if (out != null) out.clear();
    catch( Exception clearException) {
    pageContext.handlePageException( e);
    finally {
    if (out != null) out.close();
    factory.releasePageContext(pageContext);
    }You'll notice the out.flush() just prior to the pageContext.include(). BTW I have to have flush="true" or OAS throws a fit.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Sorry for any inconvenience caused.
    Thanks.<HR></BLOCKQUOTE>
    Thank you.
    null

  • Structure of jsp:include file?

    When using the jsp:include action, what should the format of the included file be, ie, what tags, if any, should exist in the file that is to be included? Should it just be the raw source?
    Further to this, if I want to encapsulate all code for a common function into a file that I'm going to be using in an include call, what if it uses a javascript file - can I include the reference to that in the file too?

    I understand the difference between the 2 options, I'm wondering more about the structure of the file that would be 'included' in either case and how I would specify the inclusion of a javascript (.js) file in the file - should there be html, head, body, etc tags in it or is it raw code?
    My scenario is that we use 'bubble help' in our web app to display tips to the users, so I want to encapsulate all the code for the bubble help in a single file that I will just include on all the pages that need it, hopefully the reference to the Javascript file would be in there as well

  • 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

  • Jsp:include strange behaviour

    Hi All
    I have a file called bottom.jsp and I want to include this file in all other jsp files in my site. This works fine for the pages that are in the same dir as bottom.jsp but for other pages that have not the same dir as bottom.jsp the links in the bottom.jsp do not refer to their correct destinations anymore.
    All helps appreciated.

    Hi,
    try changing the link in the header.html which points to target.jsp and make it relative to your application root..... then you can use it in any directory...
    header.html in D:\Tests\Web\HeaderTest
    <div align="center">Link</div>
    Hope this works :-)
    Hi Again
    But it seems that your suggestion is not working (or
    maybe something's wrong again with me). My Directory
    structure is:
    D:\Tests
    ���\Web
    ������\HeaderTest
    ���������\
    EB-INF
    ���������\
    ub
    and I have defined a Context in Tomcat like this:
    <Context
         path="/headertest"
         docBase="D:\Tests\Web\HeaderTest"
         debug="0"
         privileged="true"
    />
    and my files are:
    header.html in D:\Tests\Web\HeaderTest
    <div align="center"><a
    href="target.jsp">Link</a></div>
    target.jsp in D:\Tests\Web\HeaderTest
    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt
    ">
    <%@ page contentType="text/html; charset=utf-8"
    language="java" import="java.sql.*" errorPage="" %>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html;
    charset=utf-8" />
    </head>
    <body>
         Sample Page
    </body>
    </html>
    index.jsp in D:\Tests\Web\HeaderTest\sub
    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt
    ">
    <%@ page contentType="text/html; charset=utf-8"
    language="java" import="java.sql.*" errorPage="" %>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html;
    charset=utf-8" />
    </head>
    <body>
         <%@include file="/header.html" %>
    </body>
    </html>
    I have also tried the jsp:include action but again I
    can't get it working. When I include the header.html
    file, I want the link to refer to the
    http://localhost:8080/headertest/target.jsp but I
    don't know why it refers to
    http://localhost:8080/target.jsp which is not
    available.
    Any ideas?
    Lots of thanks again.

  • Jsp:include pointing to an action on oc4j 9.0.2

    I have set "<jsp:include page="action.do" flush="true">".
    The action is an action forward and goes to a jsp.
    But i get the following error running on oc4j 9.0.2 java.lang.IllegalStateException: Response has already been committed.
    I have tested it on oc4j 9.0.3 and it works, but i´d like to know if there´s a way to solve it on oc4j 9.0.2
    Thanks

    I added -Xcheck:jni and -Xcheck:nabounds to the command line and got this one now :
    500 Internal Server Error
    Error parsing JSP page /westflo-fsweb/main/header.jsp
    Error creating jsp-page instance: java.lang.ClassFormatError: __jspPage8_main_header_jsp (Method "pushBody" has illegal signature "()Ljavax/servonInfo.classjavax/servlet/j")
    My whole command line is :
    /usr/java130_wei/bin/java -ms128m -mx256m -Xcheck:jni -Xcheck:nabounds -Xnoclassgc -verbosegc -Duser.dir=/usr/oc4j/j2ee/home -Denvironment=DEV2GMSFS -Dwestflo.dir=/website/DEV2/GMSFS/oc4j_instance2/westflo/westflo/ -Ddeployment.dir=/website/DEV2/GMSFS/oc4j_instance2/pie/gms/ -Demissionrc.dir=/website/DEV2/GMSFS/oc4j_instance2/emissionrc/emissionrc-web/ -jar /usr/oc4j/j2ee/home/oc4j.jar -out /website/DEV2/GMSFS/oc4j_instance2/oc4j_config/log/server.log -err /website/DEV2/GMSFS/oc4j_instance2/oc4j_config/log/oc4j.err -config /website/DEV2/GMSFS/oc4j_instance2/oc4j_config/config/server.xml

  • Workshop 8.1 - jsp:include an Page Flow action resource

    Hi everybody.
    Can i use jsp:include to "include" a page flow action ?
    I've tried it, but odd things are happening: The resource got included, but fragments of html source "around" it are been lost.
    Any ideas ?
    Thanks in advance.

    Hi everybody.
    Can i use jsp:include to "include" a page flow action ?
    I've tried it, but odd things are happening: The resource got included, but fragments of html source "around" it are been lost.
    Any ideas ?
    Thanks in advance.

  • Workshop 8.1: Page Flow Action and jsp:include

    Hi everybody.
    Can i use jsp:include to "include" a page flow action ?
    I've tried it, but odd things are happening: The resource got included, but fragments of html source "around" it are been lost.
    Any ideas ?
    Thanks in advance.

    Hi Daniel
    There are 2 ways you can acheive this.
    1) Using something called Pageflowscoped form for this. This will let you use arrays for checkbox group.
    The main part will be that you need to define a member varaible of the form at the pageflow level there by the data will not be lost
    2) Using Request scoped form like you have now but need to modify the getter method to populate the "searchResult" object.
    public List getSearchResult() {
    if( null == searchResult){
    System.out.println(" Pouplate the searchResult here. ");
    searchResult= new ArrayList();
    //populate the default values.
    return this.searchResult;
    More info at:
    http://e-docs.bea.com/workshop/docs81/doc/en/workshop/guide/netui/guide/conReqScopedVsPageScopedBean.html
    I have a sample with pageflowscoped bean and requestscoped bean that I can send you if you provide your email address.
    Unfortunately we cannot attach files in the newsgroup.
    Thanks
    Vimala

  • OC4J 10.1.3.1 and Spring - jsp:include issues

    Hi,
    I've got a strange problem when using OC4J 10.1.3.1 together with Spring framework.
    I have several controllers in spring that generate things like page headers, footers, and other common elements. Historically I've merged these into a page with jsp:include or a c:import directive in the page.
    However, with the newer versions of OC4J, it will retrieve the content for the first request, and then repeat that same content for each subsequent request.
    If I replace that controller request with a direct .jsp page request, those elements are inserted and merged without any problem into the main page.
    I haven't had this problem on other servers... nor have I had the problem with OC4J until the latest release... Does anybody have an idea how to allow me to merge this Spring-Controller generated content with a jsp page successfully?
    thanks!

    Sure, I've examined it a few times when I've adjusted various JSP options.. mostly around the tag handling. By the way, right now I have Tag Resuse Default set to "compiletime with release", though I've tried the other options as well.
    __ojsp_s_out.write(__oracle_jsp_text[0]);
    /*@lineinfo:translated-code*//*@lineinfo:6^5*/ {
    String __url=OracleJspRuntime.toStr("/global/globalHeader.do");
    // Include
    pageContext.include( __url,false);
    if (pageContext.getAttribute(OracleJspRuntime.JSP_REQUEST_REDIRECTED, PageContext.REQUEST_SCOPE) != null) return;
    /*@lineinfo:generated-code*/
    __ojsp_s_out.write(__oracle_jsp_text[1]);
    /*@lineinfo:translated-code*//*@lineinfo:11^1*/ {
    String __url=OracleJspRuntime.toStr("/global/globalNav.do");
    // Include
    pageContext.include( __url,false);
    if (pageContext.getAttribute(OracleJspRuntime.JSP_REQUEST_REDIRECTED, PageContext.REQUEST_SCOPE) != null) return;
    /*@lineinfo:generated-code*/
    __ojsp_s_out.write(__oracle_jsp_text[5]);
    /*@lineinfo:translated-code*//*@lineinfo:35^1*/ {
    String __url=OracleJspRuntime.toStr("/global/globalFooter.do");
    // Include
    pageContext.include( __url,false);
    if (pageContext.getAttribute(OracleJspRuntime.JSP_REQUEST_REDIRECTED, PageContext.REQUEST_SCOPE) != null) return;
    There are three obviously.. and with this page execution I see the first one (globalHeader.do) duplicated three times in the final page.
    thanks!

  • Jsp:include issues

    I have been scouring the internet trying to find the answer to this. I am trying to impliment jsp:include in one of my assignments for school, and the only problems I have with it is that when looking at references, nobody tells you how to access the passed parameter. It's probably just so simple that I'm not seeing it right in front of me, but if anybody could shed some light on this, I would really appreciate it.

    I apologize. It was so simple that I wasn't seeing it. Please never mind. ^_^

  • Jsp include issue

    hi
    i've tested a new version of my jsp include file (a header which is referenced by about 40 pages) on one jsp page, and its wokred ok. i've changed the coding of the include page though none of the other jsp pages have picked up the new include and are still looking to the old one ? i've stopped and started tomcat but its till not changed.
    does anyone have any ideas ? i've included a couple of new tag libraries but they are working ok and i cant see why it would be anything other than tomcat ? should i try stopping the app itself ?
    cheers
    chris

    not restart, you need to clear the work directory, or at least modify all the files that use the included file to get them to recompile. The server doesn't check for changes in included files for some reason.

  • Jsp:include static svg does not work

    I am running tomcat4- and I have a jsp file that outputs svg content like so:
    <?xml version="1.0" encoding="US-ASCII"?>
    <%@ page contentType="image/svg+xml"%>
    This works fine- the problem is that up until now I have included other svg widgets like this:
    <g id="radio_off" >
                   <%@ include file="../graphics/radioButton.svg" %>
              </g>
    which also works just fine. Now, I have to change this to pass in a dynamic directory containing the image (there will be various directories with same file name- I determine at runtime which directory to use)- so I have to use a jsp:include instead.
    When I do this:
    <g id="radio_off" >
    <jsp:include page="graphics/radioButton.svg" flush="true"/>
              </g>
    When it is run I just get:
    g id="radio_off" >
              </g>
    Just blank inside the <g> . If I change radioButton.svg to radioButton.jsp and say:
    g id="radio_off" >
    <jsp:include page="graphics/radioButton.jsp" flush="true"/>
              </g>
    Then I get what I expect with
    g id="radio_off" >
    <svg width="15" height="15">
    ....and so on
              </g>
    I thought jsp:include would include the static content of a file (like html or svg), but apparently only the OUTPUT of that file.....
    Is this correct- I cannot get my svg content to be included in the svg by using jsp:include or am I missing something?
    I think it will be strange that I have to rename all my svg files jsp to get them included...Anu ideas???
    Thanks,
    Jim

    Michael,
    You are right- I reread your post more closely and saw that you are suggesting to basically just map all my static files (like the .svg) into .jsp extensions- which is basically what I was asking was true- that for svg, xml, htm, any static content to be included as in the <%@include directive but using the action <jsp:include it needs to either be changed to the extension .jsp or, as you suggested, mapped in the web.xml to .jsp. I have remapped my svg to .jsp so as to preserve their .svg extensions- (of course now the first user is hit by about 20 jsp:init's on that page!!- but is then cached as in all jsp's).
    I guess kinda makes since since the include action gets the actual response from the page (which is blank image)- but as jsp it is the actual code....Well needed confirmation- and that's what I got along with the reminder to use the mapping in web.xml.
    So thanks alot- even put extra duke in for you !!
    Jim

  • Reusing the same jsp include multiple times on the same page

    If someone knows a way out of this
    I'd like to print out 2 records of the same data type I have a JSP include which does that.
    Now my issue is how to use the same include twice on the same page
    Ideally I would like to do the following:
    <%
    request.setAttribute("person", person1);
    %>
    <jsp:include page="./person.jsp"/>
    <%
    request.setAttribute("person", person2);
    %>
    <jsp:include page="./person.jsp"/>
    And in person.jsp
    I could have
    <h:inputText name=#{person.name}/>
    This fails in the updateModel phase - And I realize why it's failing. There really is no person managed bean.
    It's just that I am at a kind of loss as to what I need to do now -
    Am missing something or is it just impossible to use jsp:includes the way Ive tried to?

    I do not understand, have you created a backing bean named person? Have you defined it in your config file?
    Please copy/paster your backing bean code and config file.
    Normally, you can set directly the value of the bean by using some java code in your jsp instead of setting the request attribute.

  • JSP include problem

    I am facing problems with the JSP include functionality in my project.
    What I want to do is to include jsp files on the fly i.e depending on the business need I should be able to swap in and out jsps from the main jsp.
    I plan to do this by feeding the file names in a request attribute and then including the files in the order given.
    But on using the jsp:include there is no output generated by the included jsp.
    There is no error either in the log or in the page directly.
    Please help me in finding out what exactly is the issue here.
    the files are index.jsp --> rightRailIncludeFiles.jsp --> dynamically loaded jsps (These may themselves contain other included files)
    index.jsp
    <div id="right" class="testRight">
        <%@ include file="rightRailIncludeFiles.jsp" %>
    </div>
    rightRailIncludeFiles.jsp
    <%
        out.println("<h1>Dyna Include</h1>");
        String fileNames = (String)request.getAttribute("jspFiles");
        String[] fileList = fileNames.split(",");
        out.println("<!-- Files : " + fileNames + " -->");
    %>
    <%
    for(int i=0;i<fileList.length;i++) {
        try {
             out.print("<!-- "+fileList[i]+" -->");
    %>
        <jsp:include page="<%=fileList%>" flush="true"/>
    <%
    } catch(javax.servlet.ServletException e) {
    out.println("<h3 style=\"color:red\"> Error :"+e.getMessage()+"</h3>");
    %>
    *inlude_1.jsp (This file includes another file which has some common code)*<jsp:include page="include/inlude_1.jsp" flush="true">
    <jsp:param name="magicNumberText" value="${request.adMagicNumberText}" />
    <jsp:param name="setType" value="${request.adSetType}" />
    <jsp:param name="width" value="${request.adWidth}" />
    <jsp:param name="height" value="${request.adHeight}" />
    <jsp:param name="adOuterDivClass" value="${request.adOuterDivClass}" />
    </jsp:include>
    Edited by: danbrown on Feb 9, 2009 2:49 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Good morning,
    I am not sure that could be the real problem , but I guess your app server does not like the fact that you broke the try catch in two parts. In any case, you should not do that :) Mixing code and display is very painful for maintenance :)
    Have you tried to remove the jsp:include and see if the output is correctly produced?
    Best Regards
    Edmondo

  • Problem when using jsp:include.. / in JSP when run on OC4J903

    I have a very unusual JSP question when run in OC4J903(EM or standalone) version (previous OC4J version was ok). Here is the description
    1. run P1.jsp and a parameter(text1) will pass to P2.jsp
    2. In P2.jsp, include "includePage.jsp" before show the parameter.
    question:
    1. The P1.jsp parameter will be null if using "POST" method, but "GET" is work.
    anyone have a indea ? or is that a bug in OC4J903 version
    P1.jsp
    <html>
    <head>
    <title>Test</title>
    </head>
    <body>
    <form method=POST action='P2.jsp'>
    <input type=text name='text1' size=30>
    <input type=submit value='OK'>
    </form>
    </body>
    </html>
    P2.jsp
    <html>
    <head>
    <title>Test</title>
    </head>
    <jsp:include page="includePage.jsp" flush="true">
    <jsp:param name="importParam" value="P2 Export" />
    </jsp:include>
    <body>
    <%
    out.print("Here shows the param from P1: " + request.getParameter("text1")+"<br>");     
    %>
    </body>
    </html>
    includePage.jsp
    <%@ page import="java.io.*"%>
    <%
    out.print("Here runs the include page. The param from P2 is: " + request.getParameter("importParam")+"<br>");
    %>

    I have a very unusual JSP question when run in OC4J903(EM or standalone) version (previous OC4J version was ok). Here is the description
    1. run P1.jsp and a parameter(text1) will pass to P2.jsp
    2. In P2.jsp, include "includePage.jsp" before show the parameter.
    question:
    1. The P1.jsp parameter will be null if using "POST" method, but "GET" is work.
    anyone have a indea ? or is that a bug in OC4J903 version
    P1.jsp
    <html>
    <head>
    <title>Test</title>
    </head>
    <body>
    <form method=POST action='P2.jsp'>
    <input type=text name='text1' size=30>
    <input type=submit value='OK'>
    </form>
    </body>
    </html>
    P2.jsp
    <html>
    <head>
    <title>Test</title>
    </head>
    <jsp:include page="includePage.jsp" flush="true">
    <jsp:param name="importParam" value="P2 Export" />
    </jsp:include>
    <body>
    <%
    out.print("Here shows the param from P1: " + request.getParameter("text1")+"<br>");     
    %>
    </body>
    </html>
    includePage.jsp
    <%@ page import="java.io.*"%>
    <%
    out.print("Here runs the include page. The param from P2 is: " + request.getParameter("importParam")+"<br>");
    %>

Maybe you are looking for