Jsp Includes ...Imp

Can you have conditional includes in Jsp
          If so how
          id like to do
          if( variable = true) then
          <%@ include file="/showOne.jsp" %>
          else
          <%@ include file="/showTwo.jsp" %>
          

That's just a simple syntax error -
          initParameter is a String - you can't compare it to a boolean. Use
          <% if( "true".equals(initParameter)) { %>
          instead - and obviously you'll have to call this jsp with
          ....?initParameter=true at the end of the URL
          "PD" <[email protected]> wrote in message
          news:[email protected]...
          > this code doesnt work try it
          >
          > Deepak Vohra <[email protected]> wrote in message
          > news:[email protected]...
          > > <%String initParameter=request.getParameter("initParameter");%>
          > >
          > > <%if( initParameter== true){%>
          > > <%@ include file="/showOne.jsp" %>
          > > <%}else{%>
          > > <%@ include file="/showTwo.jsp" %>
          > > <%}%>
          > >
          > > PD wrote:
          > >
          > > > didnt understand ur answer
          > > > please explain
          > > >
          > > > Deepak Vohra <[email protected]> wrote in message
          > > > news:[email protected]...
          > > > > <%if( variable = true){%>
          > > > > <%@ include file="/showOne.jsp" %>
          > > > > <%}else{%>
          > > > > <%@ include file="/showTwo.jsp" %>
          > > > > <%}%>
          > > > >
          > > > > PD wrote:
          > > > >
          > > > > > Can you have conditional includes in Jsp
          > > > > >
          > > > > > If so how
          > > > > >
          > > > > > id like to do
          > > > > >
          > > > > > if( variable = true) then
          > > > > > <%@ include file="/showOne.jsp" %>
          > > > > > else
          > > > > > <%@ include file="/showTwo.jsp" %>
          > > > >
          > >
          >
          >
          

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

  • 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

  • Jsp:include does not work in 8.1 SP3?

    Hi all,
              I need to include a local file (external to the app) in jsp code. The external file includes an image map which changes very so often. So in order to avoid doing a build everytime, I thought about keeping the image map in a file which can be "included" in the jsp file, making it very dynamic to a change.
              So I have a servlet which will read this file and output the contents to response.getWriter(), which will be included in calling jsp code.
              But the jsp file does not seem to call the servlet at all.
              Here is the code in the jsp file:
              <%
              String sFileUrl = "/Prj/RenderReport?file=OrgChart.html";
              %>
              <jsp:include page="<%=sFileUrl%>" />
              What am I doing wrong? Is this not possible at all?
              Thank you all in advance.

    hi pjoshi,
              <jsp:include page="hello.jsp" /> tag is working fine in weblogic 8.1 sp3.
              I think it might be syntax error in your jsp page.
              This is the syntax to including dynamic files in jsp using <jsp:include page="" />tag as given below.
              <jsp:include page="{relativeURL | <%= expression %>}" flush="true" />
              go through the below link and you will find exact information how to include dynamic files in jsp using <jsp:include page=""/>
              http://java.sun.com/products/jsp/syntax/1.1/syntaxref1112.html
              --Anilkumar kari                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • 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

  • 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

  • Jsp:include not working - Please Help.

    I am trying to do a jsp:include page but I must have the syntax wrong for the declaration of the filename. There shouldn't be a problem with my included file since it only has the word "TEST" in it. Both files are in the same directory. The error I'm getting is a 404 error.
    Message:File not found: null
    Target Servlet: File Serving Enabler
    StackTrace:
    If you look at the code, you'll see that I am doing two includes, one using the directive and one using jsp:include. The directive one comes up fine but not the jsp:include. Thanks for any help. Here's my code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML><HEAD>
    <META name="GENERATOR" content="IBM WebSphere Page Designer V3.5.3 for Windows">
    <META http-equiv="Content-Style-Type" content="text/css">
    <TITLE>This is the page title</TITLE>
    </HEAD><BODY>
    <center>
    <table border="1">
    <tr>
    <td align="center"><jsp:include page="navigationTest2.html" flush="true"/></td>
    <td align="center"><%@ include file="navigationTest2.html" %></td>
    </tr>
    </table>
    </center>
    </BODY></HTML>

    Yeah I know, I tried that. I did notice that the directive include doesn't accept the path the same way. If I put in the full path /test/navigationTest1.html the compile would tell me couldn't read file, but the path of the file it was trying to read was /test/test/navigationTest1.html. I took the /test out and just left the / and could not read the file in the root dir, of course, because it's in the test dir. So now I have the full path /test/navigationTest1.html in the jsp:include and no path in the directive include and same results.

  • 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>");
    %>

  • Jsp:include doesn't work with Tomcat & IIS

    Hi, Guys,
    I installed IIS4.0 and Tomcat in my windows NT system. http://localhost/examples/jsp/index.html works fine.
    When I load http://localhost:8080/about.jsp, it's also working fine. But when I load http://localhost/about.jsp, it will ignore the part which the line is display as
    <%String topName = "/servlet/topServlet";%>
    <jsp:include page="<%=topName%>" flush="true"/>
    The other part will work just as a html file. And I didn't get any error message.
    Would can tell me how to figure out this problem. Thank in advanced very much!

    Oh, God, why not tell me earlier!!!!!! I do use tomcat 3.1 and it just support servlet. I have no way out but modify all my jsp:include to encoding into a servlet page. I almost re-do all my work. But anyway, thank you! Next time I will know.

  • JSP include directive not working with Tomcat 5.0

    Hi.
    I'm developing a small JSF webapp under Tomcat 5.0. My idea was to use the include directive to display a navigation panel on every JSP page.
    I took the code straight from the Java Web Services Tutorial; the resulting page looks like this:
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:h="http://java.sun.com/jsf/html"
           version="2.0">
    <jsp:directive.page contentType="text/html;charset=iso-8859-1"/>
    <%@ include file="/jsp/panelpage_header.inc" %>
         <h:outputText value="Welcome!"/>
    <%@ include file="/jsp/panelpage_footer.inc" %>
    </jsp:root>However, when I try to load the page, a compilation error occurrs:
    org.apache.jasper.JasperException: /trias/welcome2.jsp(11,2) The content of elements must consist of well-formed character data or markup.
         org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
    ...I checked the path to the included files, and it seems to be okay. The files themselves contain the JSF tags for the view, html-head, html-body etc. The compiler doesn't even care if the files exist or not because it aborts immediately when it reaches the first include-statement.
    Did anyone see this kind of error before?

    Ok, the solution with jsp:directive.include works,
    if header.inc and footer.inc themselves are well
    formed too. If I understood the concept right this is
    because header and footer are processed during
    request time and therefore interpreted as
    'standalone' pages.This isn't true. The include directive (<jsp:directive.include>) is run a Compile Time. The code is inserted directly into the surrounding JSP (unlike <jsp:include> which forwards the request at runtime). The finished JSP, after the include, is then processed and needs to be well-formed XML.
    >
    But: What can I do when these two files define a tag
    that should enclose my current page (for example,
    header opens a panelGrid-Tag, and footer closes it).
    For this case I thought the use of the
    @include-directive would be neccessary to combine the
    three pages during compilation. By this the resulting
    page would be well-formed although header and footer
    are not.It should be, as long as you are using <jsp:directive.include>, and the rest of the included pages are also well formed (no <% %> tags, nothing else out of place...).
    Honestly, I haven't done much work with JSP documents, so I haven't run into this problem. But I do believe everything I said is correct.
    What I would do is double check the correctness of the rest of the included pages and see if your error isn't something else.

  • Paths in JSP Includes

    I can successfully use a JSP Include line in my code if the included file is in the same folder as the code, but all attempts to point to another folder on the same server have been unsuccessful.
    I need to go "up" four levels and then down three in another directory. I've tried using "..\..\" and also going out to the root and then down - no luck.
    Example: my code is in C:\abc\def\ghi\jkl\mno and I need to include a file in C:\pqr\stu\vwx
    Any help would be appreciated. Thanks.

    that folder needs to be in your web project's context root.
    for Example, assume that your web project name is myWeb ( also is the folder Name)
    Here your project root is myWeb, and you can only inlude any JSP under myWeb folder, not out side of it.
    c:\java\projects\myWeb\jsp\
    and you have sub folders under jsp
    c:\java\projects\myWeb\jsp\accounts\
    c:\java\projects\myWeb\jsp\personal
    c:\java\projects\myWeb\jsp\finance

  • How to Parse Escape Character(&) with JSP Include URGENT

    Hi,
    I guess anyone could help me out.
    I have a JSP file where I am including another JSP file and setting parameter for that include file. Among those parameters one of the parameter is having a value having ampersand with it. like R&D. In such case am i getting following error.
    I dont know how should I get rid of this &.
    I tried converting it to amp; even tried \\& also tried using escape("R&D"). But no success. Can you guys help
    Code:
    <jsp:include page="../hottopics/controller_hottopics1.jsp" flush="true">
    <jsp:param name="UserID" value="<%=username%>" />
    <jsp:param name="kmsid" value="<%=kmsid%>" />
    <jsp:param name="department" value="<%=department%>"/>
    <jsp:param name="location" value="<%=location%>"/>
    <jsp:param name="supportorg" value="<%=supportorg%>"/>
    <jsp:param name="supportflag" value="<%=supportflag%>"/>
    </jsp:include>
    department : R&D
    Error :
    java.lang.IllegalArgumentException
    at javax.servlet.http.HttpUtils.parseQueryString(HttpUtils.java:151)
    at org.apache.tomcat.facade.RequestDispatcherImpl.addQueryString(RequestDispatcherImpl.java:546)
    at org.apache.tomcat.facade.RequestDispatcherImpl.doInclude(RequestDispatcherImpl.java:388)
    at org.apache.tomcat.facade.RequestDispatcherImpl.include(RequestDispatcherImpl.java:270)
    at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:414)
    at ITHelpAlerts_0002dv_00034._0002fITHelpAlerts_0002dv_00034_0002fgadget_0002ejspgadget_jsp_7._jspService(_0002fITHelpAlerts_0002dv_00034_0002fgadget_0002ejspgadget_jsp_7.java:210)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.jasper.servlet.JspServlet$JspCountedServlet.service(JspServlet.java:130)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:282)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:429)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
    at org.apache.tomcat.core.Handler.service(Handler.java:287)
    at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
    at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:812)
    at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
    at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
    at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
    at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
    at java.lang.Thread.run(Thread.java:534)

    Okay, not surprising. Like I said, the & has special meaning in URLs, to seperate one parameter from the next. Perhaps you should thing about using request attributes instead of parameters:
    request.setAttribute("department", "R&D");
    //then on recieving side
    String department = (String)request.getAttribute("department");

  • Reloading a jsp include file

    Lets say I have a container,
    <div id="mindmapcontainer">and within this container, I have a jsp include
    <%@ include file="mindmap.jsp"%>and within the parent page there is a flash map. I have manipulated the css in such a way that this container (and its include file) will not show unless the user clicks on a country (using visibility hidden/visible). I understand that the external file loads on the server side when the parent page loads,despite it being hidden.
    Now the problem is, I'm missing some fancy effects that is shown only when the external jsp first loads. Is there any way I can make it reload onClick?
    I'm using ammap and js-mindmap btw.

    nope using window.location.reload() will reload the entire page.and i dont want that because it will get me back to my flash map screen and not the mindmap screen.thanks for your answer anyway.is there is a way to make it reload a div only or a jsp include?

  • JSP:Include directive - can I access data?

    Hi,
    I am using the 'include' directive (either jsp:include method or <%@ include.... /> ) to include another jsp page.
    I want the included file to access variables that have been set up in the main page (the one with the include directive in it). I've tried several things, including setting up a Bean class, but nothing seems to work
    Is this possible? I really appreciate any help with this.
    Thanks.

    You cannot use <%@ include ..%> because that is resolved at translation time. <jsp:include /> is resolved dynamically and should give you what you need. In the main page, store references to the bean or other data as request attributes and then retrieve them in the included page.

  • 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

Maybe you are looking for

  • Suggestion for a new Layout-Mannager.

    Hi, i don't know if something like this is allready in the Jdk1.4. I haven't found it. It would be nice if there wolud be an Layout-Manager where you can say: I want e.g. 5 rows and 8 columns and than I can add components with using options like rows

  • BOOT CAMP WONT INSTALL

    this is what happens, i partition the disk with boot camp assistant, then it partitions, i restart using windows cd, and the screen goes black and it stays that way and no thing happens, any ideas?

  • SetAdditionalJoinExpression and Named Queries...

    Hi, is it possible to use DescriptorQueryManager.setAdditionalJoinExpression() to append additional filters to sql statement named queries? I've tried this but it doesn't seem to have any effect. If this is not possible, do you know of any alternativ

  • Printing sales order details using adobe forms

    hi all, i need to print the sales order header and the respective item details using the adobe form.my requirement is to print the header on each and every page. for suppose my header is say '1' it contains 20 item details,and the page can hold 15 it

  • New iMac, what to do with Macbook Pro

    Hi there, Okay, I have me new 27" iMac and all my files transferred, but I'm unsure of what to do with my Macbook Pro. (And don't say send it to me! ) Is there an easy way to keep all my files synced between the two? I'm not sure if I will use my MBP