Multiple Includes in JSP

          Hi,
          I'm getting a parsing exception when I try to include multiple jsps in the one
          jsp page. Any help would be greatly appreciated!
          The jsp code causing the error is:
                         <%@ include file="mbrDspProfileTravellerInfoPersonal.jsp" %>
                         <%@ include file="mbrDspProfileTravellerInfoAirPref.jsp " %>
                         <%@ include file="mbrDspProfileTravellerInfoCarPref.jsp " %>
                         <%@ include file="mbrDspProfileTravellerInfoHotelPref.jsp " %>
          and the error in the weblogic.log is:
          <16-Jan-02 09:25:00 GMT> <Error> <HTTP> <[WebAppServletContext(8046543,DefaultWebApp,/DefaultWebApp)]
          Root cause of ServletException
          weblogic.utils.ParsingException: nested TokenStreamException: antlr.TokenStreamException:
          Could not include mbrDspProfileTravellerInfoAirPref.jsp
               at weblogic.servlet.jsp.JspLexer.parse(JspLexer.java:1017)
               at weblogic.servlet.jsp.JspParser.doit(JspParser.java:78)
               at weblogic.servlet.jsp.JspParser.parse(JspParser.java:181)
               at weblogic.servlet.jsp.Jsp2Java.outputs(Jsp2Java.java:119)
               at weblogic.utils.compiler.CodeGenerator.generate(CodeGenerator.java:255)
               at weblogic.servlet.jsp.JspStub.compilePage(JspStub.java:327)
               at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:189)
               at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:154)
               at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:368)
               at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:242)
               at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:304)
               at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
               at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2456)
               at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2039)
               at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
               at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
          

          Thank you so much!!!
          Maeve
          "Michael Reiche" <[email protected]> wrote:
          >Remove the space between the 'p' and the closing quote.
          >
          >Mike
          >
          >
          >"Maeve Loughnane" <[email protected]> wrote in message
          >news:[email protected]...
          >>
          >> Hi,
          >> I'm getting a parsing exception when I try to include multiple jsps
          >in the
          >one
          >> jsp page. Any help would be greatly appreciated!
          >>
          >> The jsp code causing the error is:
          >>
          >> <%@ include file="mbrDspProfileTravellerInfoPersonal.jsp" %>
          >> <%@ include file="mbrDspProfileTravellerInfoAirPref.jsp " %>
          >> <%@ include file="mbrDspProfileTravellerInfoCarPref.jsp " %>
          >> <%@ include file="mbrDspProfileTravellerInfoHotelPref.jsp " %>
          >>
          >> and the error in the weblogic.log is:
          >>
          >>
          >>
          >> <16-Jan-02 09:25:00 GMT> <Error> <HTTP>
          ><[WebAppServletContext(8046543,DefaultWebApp,/DefaultWebApp)]
          >> Root cause of ServletException
          >> weblogic.utils.ParsingException: nested TokenStreamException:
          >antlr.TokenStreamException:
          >> Could not include mbrDspProfileTravellerInfoAirPref.jsp
          >> at weblogic.servlet.jsp.JspLexer.parse(JspLexer.java:1017)
          >> at weblogic.servlet.jsp.JspParser.doit(JspParser.java:78)
          >> at weblogic.servlet.jsp.JspParser.parse(JspParser.java:181)
          >> at weblogic.servlet.jsp.Jsp2Java.outputs(Jsp2Java.java:119)
          >> at weblogic.utils.compiler.CodeGenerator.generate(CodeGenerator.java:255)
          >> at weblogic.servlet.jsp.JspStub.compilePage(JspStub.java:327)
          >> at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:189)
          >> at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:154)
          >> at
          >weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:36
          >8)
          >> at
          >weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
          >:242)
          >> at
          >weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
          >:304)
          >> at
          >weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
          >:200)
          >> at
          >weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
          >ntext.java:2456)
          >> at
          >weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
          >:2039)
          >> at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
          >> at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
          >
          >
          

Similar Messages

  • Using a real file path to include a JSP using RequestDispatcher

    Hi,
    I am trying to figure out how to use RequestDispatcher inside a servlet to include a jsp page using a real file path instead of a context path. So for example I would want to do something like...
    RequestDispatcher rd = this.getServletContext().getRequestDispatcher("c:/tomcat/conf/think.jsp");
    Is this possible? tomcat is complaining that the path does not start with a "/"
    From a higher level I am trying to setup a solution where all of my web applications can share a set of global jsp pages and other resources. I know the easiest solution would be to put everything into one web application but this does not make sense in my situation because I have differnet web applications for different companies on the same server. Any help would be greatly appreciated. - krebsnet

    First of all...
    My test environment is Tomcat 4.1.24 and it runs on port 80 as my webserver as well.
    I can place the .jsp (or .html) in the shared folder. Not in the lib or class folders but right in the shared folder. I can then call it from multiple contexts without using the context path. Just tested it a minute ago. For example I have test.jsp in the shared folder and loaded it from two separate contexts (one named /demo and one named /inetapps) by calling Load test. It loaded in both of them and neither contain a test.jsp file.

  • Multiple inlcude in jsp.

    Can multiple files be included in jsp?
    I m doing like this,
    <%@include file="topMenu.jsp" %>
    <%@include file="navMenu.jsp" %>
    but it gives me error,
    Page directive: can&#39;t have multiple occurrences of language

    You can have multiple includes but you have to be sure that there are no duplication of certain items. I think that the message " Page directive: can't have multiple occurrences of language" might be saying that you have duplicates of something like:
    <%@ page language="java" %>If that is your problem, just get rid of this. It isn't really needed since this is the default.

  • Include directive to include a JSP file from a JAR file

    I have an Eclipse project in which I have placed a JSP file in the package structure with the rest of my code. This is in fact only a code snippet page, not a full blown JSP file.
    I have a second project that is a Dynamic Web Project in Eclipse that incorporates the first project as a JAR in the /WEB-INF/lib directory.
    In this project I have a JSP file and I want to include the JSP file embedded in that JAR file.
    How do I do that?
    I'm thinking the only real solution is to rewrite the snippet portion as a custom tag.

    The JSP fragment page in question is actually a HTML form page. It is a form to be used specifically by a particular servlet. That is why they are "bundled" together in the same project, in the same package structure.
    I have multiple web applications that I want to include that form/servlet, so it gets added to these projects in the /WEB-INF/lib folder as a JAR library. But I don't want to recreate the form over and over again for each application. It would be nice if I could write a JSP page that wraps the fragment using an include directive to bring that fragment into the new page.
    So to do that with any other fragment I would write:
    <%@ include file="/WEB-INF/jsp/SOME_FORM.jsp" %>
    which works great if my fragment page is in the /WEB-INF/jsp subfolder. But if I want to access the JSP fragment as it is bundled in a JAR file, this:
    <%@ include file="/WEB-INF/lib/FORM.jar/SOME_FORM.jsp" %>
    doesn't work so good. It's just all wrong.
    I was wondering how I could just write one include statement to get what I need. There are work-arounds galore, but I thought if I could get this working it would be the simplest solution overall.

  • How to include a jsp page in another jsp jsp page

    hi,
    i m trying to include a jsp page name "header.jsp" into one jsp page name"selectattribute.jsp" i m using these commands in "selectattribute.jsp"
    <%@include file "header.jsp"%> bcz both these jsp page are C:\program files\tomcat 4.0\webapps\examples\jsp\Poject\
    but the problem is that , i m invoking this jsp page "selectattribute.jsp" from a servlet reportcontroller.java using REQUEST DISPATCHER.
    the servlet is in
    C:\Program files\tomcat 4.0\webapps\examples\WEB-INF\classes\Project\
    i want to know how to include some other jsp page in a jsp page and how to invoke applet from jsp page when that particular jsp page is being invoked by servlet.
    plz help
    manish

    use this for including in your selectattribute.jsp
    <jsp:include page="header.jsp" flush="true"/>
    I never tried calling an applet. I think you can write the code for calling the applet in a javabean method and call the method in the jsp

  • In portlet context include a jsp from the desktop context

    Hi,
    I developed a portlet, and in my jsp file I want to include a jsp file which is in my portal desktop (the file is in /etc/opt/SUNWps/desktop/..).
    So I want to do something like:
    <c:import url="file:///etc/opt/SUNWps/desktop/mydesktop/ PortletHeader.jsp" /> Of course this doesn't work because the jsp expressions are not executed, instead the jsp tags are just displayed in the browser.
    but for including a jsp with <@include file> or <c:import> or <jsp:include>, the jsp must run in its context. So actually we should do something like <c:import url="some_path" context="some_context" >.
    Now, I don't know what some_context is. To what context the portal desktop runs so the jsp file can be 'executed'?
    Hope someone can give me some more information about this.
    Greets,
    Tim

    <quote>some_context <quote>
    ..will be the pageContext
    which is the implicit object for a JSP.
    or
    use config object to get this context and then use
    <jsp:include> or <@include file>
    rgds
    http://lokeshpant.blogspot.com

  • Including a jsp on the same page by clicking a button

    Hi,
    I have a jsp page where there are many controls and some buttons. If I click a buton called "Edit" I need to include a jsp page below the existing controls.
    Can someone please tell me how to do that?
    <tr>
    <td>
    <a><img name="View" src="view.gif" border="0"/></a>
    <a><img name="Edit" src="edit.gif" border="0"/></a>
    </td>
    </tr>
    this is thecode which I have for buttons in my page
    Thanks

    Using javascript, you could wrap the included page within a DIV tag or SPAN tag that is initially not visible. Then when the user clicks the button you would make the hidden DIV or SPAN visible.
    The visibility attribute can be set to visible (to see it) or hidden (to not see it). Here's a page that might shed some light:
    http://www.csctce.com/demos/dom_tutorial/
    HTH

  • How can I include a JSP, Maximized, and retain look and feel(WSRP)

    I have created a page group and defined a root page with a certain look and feel. There are two portlets on the page. Once the user clicks on a submit button, the portlet performs some action and includes a jsp included in the EAR file. The portlet needs to maximize the UI to display the jsp correctly.
    Once control returns back to the screen, the look and feel is lost and uses Oracle's default style. I have two questions:
    1. From the portlet, how can I retain the look and feel of the page group when referencing "external" jsp (i.e JSPs in the deployed portal EAR file).
    2. How can I "redirect" the user to the home page in a standard way? If there is not a standard way, how do I use the Oracle specific utilities to do it?
    All of my JSPs are developed externally out of the scope of the Oracle Portal.
    Environment - Oracle Portal 10.1.4 on Release 2 using WSRP to contact Oracle Release 3, hosted EAR file (WSRP Producer).
    Thanks in advance.

    Hi José,
    I don't think that is possible. But you can import the css files that ep uses for its look and feel and try to give your web pages similar look and feel. The tables and other controls used in EP are totally different and are done through complex JavaScript coding instead of simple HTML tags. If you want exact lok and feel then i thin you must go for a Webdynpro based application rather then a J2EE application with JSPs.
    Regards,
    Guru.
    PS: Give points for helpful replies.

  • Friends..how can i include a jsp page in a servlet

    like i want to use like
    if(conditionl)
    out.println(" welcome");
    //////// here i want to include some jsp page /////
    I tried with...
    <% @include %> but its not working
    Thanks in advance

    I tried with...
    <% @include %> but its not working
    Thanks in advanceThat only woks for JSP Pages.
    You have to call the include method of the RequestDispatcher
    if(conditionl)
      out.println(" welcome");
      getRequestDispachter("/myJSPDir/my.jsp").include(request, response);
    }

  • How can i include a jsp file in servlet?

    hi
    i generate a dynamic page from servlet.
    i need to include a jsp file in same servlet.
    i try like this --
    out.println("<HTML>");
    out.println("<HEAD><TITLE>First</TITLE></HEAD>");
    out.println("<BODY>");
    out.println("<%@ include file=\"abc.jsp\">");
    out.println("<FORM>");
    out.println("</FORM>");
    out.println("</BODY>");
    out.println("</HTML>");

    Replace your line with
    RequestDispatcher rd = request.getRequestDispatcher("abc.jsp");
    rd.include(request, response);

  • How to include a jsp in child window?

    Hi,
    I've a jsp which creates a new window(a new jsp using window.open()) while clicking a button.In the new jsp i'm including another jsp using ,
    <jsp:directive.include file="first.jsp"/>
    but in the window jsp's is not getting included.I've tried <%@ ..
    include also.But all in vain.
    Additionaly I'm giving css in the window using
    <link ref="stylesheet" href="/editor/mystyle.css"/>
    which is also not working.
    Can somebody help on this?
    Thanks,
    Shabeer.

    hi
    I think this url can helps to your for resolve your issue.
    http://www.oracle.com/technology/sample_code/tech/java/jsps/ojsp/jspxml/Example.jsp.html
    Regards,
    Sridhar

  • How to include more jsp?

    Hi,
    I've header.jsp, footer.jsp, content.jsp (which is loaded dynamically) and a main.jsp. I would include all jsp into main.jsp.
    This is the header.jsp
    <div id="logo" align="top">
    <img src="http://www.company.com/images/logo-red.gif"/>
    <div class="user-info">Welcome, <h:outputText value="#{user.email}"/></div>
    </div>
    The footer.jsp is
    <div id="footer">
    <div id="footer-copyright">Copyright &copy; 2006 MyCompany, Inc.</div>
    </div>
    The content.jsp is
    <h:dataTable value="#{controller.renderedSteps}" var="vitem"
    rowClasses="stepdescription-text">
    <h:column>
    <h:outputText id="stepDescription" value="#{vitem.step.description}"/>
    </h:column>
    <h:column>
    <h:commandButton value="next step"
    action="#{controller.nextStep}"
    rendered="#{vitem.isRendered}"
    disabled="#{vitem.isDisabled}" />
    </h:column>
    </h:dataTable>
    The body of main.jsp is
    <body>
    <f:view>
    <h:panelGrid>
    <jsp:include page="header.jsp"/>
    <jsp:include page="content.jsp"/>
    <jsp:include page="footer.jsp"/>
    </h:panelGrid>
    </f:view>
    </body>
    The problem is that when I load the main.jsp seems that the <div> are ignored.
    I'm very new in JSF and JSP\HTML.
    Thanks

    Use f:subview and use f:verbatim.
    First, f:verbatim... This JSF tag allows you to write HTML verbatim to your page. Whenever you have an HTML tag in any included page from a JSF app, it must be wrapped in f:verbatim. It is also good practice to use f:verbatim in your main page too, though it is not absolutely required. Do not wrap JSF tags in f:verbatim, it will not work.
    A general rule of thumb is to attempt to use as little HTML as possible. The JSF tag set with CSS actually eliminates the need for a great deal of HTML. I suggest picking up a good book that explains each component in the JSF library. Such as Core JavaServer Faces by David Geary and Cay Horstmann. Some free chapters can be found here (Check out "Basic Standard Components): http://www.horstmann.com/corejsf/
    Seconly, use f:subview when including a page. Either inside the included JSP or around the include statement. Like so:
    <f:subview id="header">
        <jsp:include page="header.jsp"/>
    </f:subview>
    OR
    <f:subview id="header">
    <f:verbatim><div id="logo" align="top">
    <a href="http://www.mycompany.com/">
    <img src="http://www.company.com/images/logo-red.gif"/>
    </a>
    <div class="user-info">Welcome, </f:verbatim><h:outputText value="#{user.email}"/><f:verbatim></div>
    </div></f:verbatim>
    </f:subview>For more information, check out this related forum posting:
    http://forum.java.sun.com/thread.jspa?threadID=715984&start=10&tstart=0
    Hope this helps!
    CowKing

  • Possible to include a JSP in  a component response ?

    Hello,
    I am writing an UI component that needs to include a JSP in its response and I am having some issues with the include:
    In the encodeBegin() method of the component, I do the include like this:
    HttpServletRequest request = (HttpServletRequest)context.getExternalContext().getRequest();
    HttpServletResponse response = (HttpServletResponse)context.getExternalContext().getResponse();
    ServletContext servletContext = (ServletContext)context.getExternalContext().getContext();
    RequestDispatcher disp = servletContext.getRequestDispatcher(uri);
    disp.include(request, response);
    The called page is included in the response, but at the beginning of the page, not inside the calling component response. I am guessing it is because context.getResponseWriter() returns a different writer than the one obtained from the HttpServletResponse used in the included page, and that the 2 responses (the JSF and the included page) are assembled only when the JSF rendering is over.
    Has anyone been confronted to the same problem, and if so, have you been able to solve it ?
    Thanks in advance for any help.

    Hi,
    I suppose you have the same kind of problem discussed here
    http://forum.java.sun.com/thread.jsp?forum=427&thread=516289
    When you use includes, you have to use subviews and verbatims tags.
    The funny thing is, you'll probably encounter the verbatim tag bug, which was blocker for me, so I switched to MyFaces.
    Frederic

  • Include a JSP file located in a JAR

    how is it possible to include a jsp file which is located in a jar? perhaps someone has already a solution for this hoping
    what I already have found out is that jasper parser supports loading JSP files out of JARs, indeed. but when using a <%@import file="foo.jsp"%> directive, this special method is not called. is there some workaround? should I set some special property?
    thx

    Did you ever figure this one out?

  • Include a jsp file in the same page by click on a button

    Hello Everybody
    I'd like to control "my.jsp" page by clicking on some buttons. So if I click on Button1, f1.jsp go to be includeing in "my.jsp" or Button2 to include f2.jsp on "my.jsp" and so on
    Thank you in addvance

    In my.jsp you could put a form with n submit buttons whith different values of parameter "name", like this:
    ---My.jsp------
    <form method="yourMethod" action="My.jsp">
    <input type="submit" value="Button1" name="button1">
    <input type="submit" value="Button1" name="button2">
    <input type="submit" value="Buttonn" name="buttonn">
    </form>
    <%if(request.getParameter("button1")!=null){%>
    <jsp:include page="f1.jsp">
    <%}%>
    <%if(request.getParameter("button2")!=null){%>
    <jsp:include page="f2.jsp">
    <%}%>
    <%if(request.getParameter("buttonn")!=null){%>
    <jsp:include page="fn.jsp">
    <%}%>
    I didn't try it but it might work.

Maybe you are looking for