Can Request Dispatcher include 2 Jsp's ??

HI ...
can Request Dispatcher include 2 Jsp's.....in which
second Jsp is accessing some parameters from First Jsp....
From my point of view , both jsp's are get compiled seperately hence
2nd Jsp is not getting parameters from 1st Jsp..
Any other way to solve this problem....???
rdTop = sc.getRequestDispatcher("/Reports/top.jsp");
rdTop.include(req,res);
rd1 = sc.getRequestDispatcher("/Reports/MenuTrail.jsp");
rd1.include(req,res);
Thanks

No Actually ,i am using include becoz Top .jsp includes our menu,& menu trail also contains our menu...i am displaying both Jsp's thru
servlet hence i have used Include.....
Thanks

Similar Messages

  • Query Strings in Request Dispatcher Paths (PLT.16.1.1)

    I'm having trouble using query strings in a request dispatcher include to a servlet.
    I'm spitting debug out, and it looks like I'm calling:
    PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/myServlet?myparam=myparamValue");
    And myparam isn't being set for myServlet.
    The same URL ("http://myhost:myport/myPortal/myServlet?mayparam=mayparamValue)
    runs fine standalone....

    I'm not sure of the exact dates (either this month or the next). But
    JSR168 will be supported in the service pack.
    Subbu
    T-Bone said the following on 11/18/2003 09:23 AM:
    Subbu Allamaraju <[email protected]> wrote:
    There is a known bug in WLS's servlet container that results in this
    behavior. Please contact support if you need an expedited solution.Thanks, they said to wait for SP2 sometime end of November.
    Can you tell me when it will be available?
    Also, when will JSR-168 v1.0 be supported?
    Subbu
    T-Bone said the following on 10/26/2003 03:14 PM:
    I'm having trouble using query strings in a request dispatcher includeto a servlet.
    I'm spitting debug out, and it looks like I'm calling:
    PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/myServlet?myparam=myparamValue");
    And myparam isn't being set for myServlet.
    The same URL ("http://myhost:myport/myPortal/myServlet?mayparam=mayparamValue)
    runs fine standalone....

  • Is it a bug in 9.0.3 :Unable to dispatch to requested page: Error in JSP

    Hi I am getting the following error
    ============================Error start==================
    web-app: JspServlet: unable to dispatch to requested page: Exception:oracle.jsp.parse.JspParseException: Line # 2, &lt;jsp:useBean id="result" scope="request" type="ActionResult" /&gt;
    Error: Unable to find class for bean: result defined by tag with class: ActionResult
    ========================Error ends===================
    My configuration is as follow
    I have EAR File which consist of common file in library for ejbs,servlet & jsps
    I set the classpath for ejbs and web-app in manifest.mf for both jar as well as war file. My servlet can see the ActionResult class but jsp cannot see it.
    In my orion-web.xml I have the following line
    &lt;web-app-class-loader search-local-classes-first="true" include-war-manifest-class-path="true" /&gt;
    In my global-web-application.xml I have the following line at last
    &lt;web-app-class-loader include-war-manifest-class-path="true"/&gt;
    But still it cannot see the ActionResult class file which is in common library file.
    I am using
    Oracle9iAS (9.0.3.0.0) Containers for J2EE (build 020927.1699)
    Any help is appreciated.
    Thanks

    Where can I download my test ear file.
    Any way I am keep my source here.
    My Servet Source
    =============================================
    package com.ritesh.tempwork;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;
    public class MyServlet extends HttpServlet {
    * Initialize global variables
    public void init(ServletConfig config) throws ServletException {
         super.init(config);
    * Service the request
    public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
         //getAction
         request.setAttribute("result",new ActionResult());
         this.getServletContext().getRequestDispatcher("/test.jsp").forward(request, response);
    * Get Servlet information
    * @return java.lang.String
    public String getServletInfo() {
         return "com.aclcargo.servlet.ActionMultiplexer Information";
    * Insert the method's description here.
    * Creation date: (7/13/2001 5:30:57 PM)
    public void destroy()
    ====================================================
    My Action Result class
    =====================================================
    package com.ritesh.tempwork;
    i[i]Long postings are being truncated to ~1 kB at this time.

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

  • Can we include a JSP page in an already included JSP Page

    Hi guys,
    I have a doubt with JSP include tag. The problem is ..
    Can we include a JSP page in an already included JSP Page
    AS shown below
    I have one JSP page
    Index.jsp
    -in this I am including "include.jsp"
    -Again within the "include.jsp" I am including "include1.jsp"
    It is neither giving an error nor displaying the content which is there in the "include1.jsp" but it is displaying the content of "include.jsp"
    first of all let me know whether it is possible or no.. If so then why is it not coming and what is required to do this..
    fast...
    Thanks
    Sreenadha Reddy K

    Hi guys,
    I have a doubt with JSP include tag. The
    g. The problem is ..
    Can we include a JSP page in an already included JSP
    Page
    AS shown below
    I have one JSP page
    Index.jsp
    -in this I am including "include.jsp"
    -Again within the "include.jsp" I
    he "include.jsp" I am including "include1.jsp"
    It is neither giving an error nor displaying the
    content which is there in the "include1.jsp" but it is
    displaying the content of "include.jsp"
    first of all let me know whether it is possible or
    no.. If so then why is it not coming and what is
    required to do this..
    fast...
    Thanks
    Sreenadha Reddy KIt is possible , u just have to change all the files and save them all again, clear the temp dirs where all the jsp's as compiled. Now after all this try , it should work .

  • 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

  • Nested request dispatches when using RequestDispatcher in a Button action

    Hi all,
    I am new to JSF so I am probably missing something very simple, please help:
    The test case is simple: I created one visual web page with one button and one normal JSP file(named test.jsp) using Netbeans 5.5 with visual web pack on Sun Application Server 9 PE. The code action for the button is as follows:
    public String button1_action() throws Exception
            ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
            HttpServletRequest request = (HttpServletRequest) context.getRequest();
            HttpServletResponse response = (HttpServletResponse) context.getResponse();
            RequestDispatcher dispatcher = request.getRequestDispatcher("test.jsp");
            dispatcher.forward(request,response);
            return null;
        }Once the JSF page is loaded and the button is clicked, this exception occurs:
    ApplicationDispatcher[WebApplication1] Servlet.service() for servlet Faces Servlet threw exception
    javax.servlet.ServletException: WEB2651: Exceeded maximum depth for nested request dispatches: 20
    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:837)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:697)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:532)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:465)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:353)
    at webapplication1.Page1.button1_action(Page1.java:242)
    Can anyone provide any advice on how to resolve this issue?

    Hi Rachel,
    As per the Servlet2.3 Javadoc:
    The pathname must begin with a "/" and is interpreted as relative to the current context root.
    If you make that change and include the complete path, then it would work fine.
    Ex:
    If your context looks like http://my.company.com/webapp1/ and if you were to have your forwardPortlet.jsp in a directory like:
    webapp1
      |
      |-> htdocs
             |
             |-> forwardPortlet.jsp
    then, your code would look like;
    RequestDiscpatcher d = request.getRequestDispatcher("/htdocs/forwardPortlet.jsp");
    HTH,
    thanks,
    harsha

  • Include a jsp in another

    I wanr to include a jsp into another, but dinamically. I have a file named Inicio.jsp. This file has a link that calls the servlet "ServletMenu". This servlet decides which jsp page to load. But I want to load "inside" the Inicio.jsp.
    Here a send some code
    Inicio.jsp: shows a menu
    <tr>
    <td>Menu 1</td>
    </tr>
    ServletMenu
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    response.setContentType(CONTENT_TYPE);
    String operacion = (String)request.getParameter("operacion");
    if(operacion.equalsIgnoreCase("menu1")) {
    RequestDispatcher dispatcher = this.getServletContext().getRequestDispatcher("/WebModulo1/Menu1");
    dispatcher.forward(request, response);
    Menu1 contains a form
    The page given by the servlet should show everything that is shown in Inicio.jsp and in the middle of the page should be the content of the Menu1.jsp.
    Am I clear? The idea is mantain a fix menu and load only dynamic content in the middle of the page.
    hope you can help

    I have the code working but ServletMenu only loads the Menu1.jsp and that is not what I want.
    I' m developing an Intranet site. Depending on the user that is logged, the menu that is shown, because not all users have access to all the system tasks.
    I thought of having the pages containing the menu shown to the user done statically and in the middle of that statical page load the content of a dynamic page.
    For example, suppose I have in the server the pages Inicio.jsp, that shows the menu, and Menu1.jsp that shows the same things that Inicio.jsp (but the link to menu1should not exit) and whatever is loaded when the user clicks in the link menu1 of the Inicio.jsp page. The "whatever is loadded" will be another .jsp page, that should be inside Menu1.jsp.
    Hope I'm clearer this time
    Thanks

  • Urgent, creating xml files dynamically, request dispatcher problem

    hi all,
    Problem 1:
    There is a problem we are facing, while request dispatching.
    The files CBECBC.XML & CBECBC_Envelop.XML,
    both xml files. These files are created on request from the user, dynamically, and displayed on the browser,
    by including them in a jsp page.
    Here we face a problem when they are to be included into the jsp page.
    The error is the following :
    //////// Error ////////
    Could not find request dispatcher for the url CBECBC.xml
    Could not find request dispatcher for the url CBECBC_Envelop.xml
    The created files are stored in the "d:\pstudio35\desks\bank\BankWeb\".
    We are using " <jsp:include page="...."/> " (dynamic jsp include tag), to include the xml files.
    Problem 2:
    And could you just let me know how to include a xml file in a jsp file,
    so that the xml file is displayed in the exact format of xml(with the tags).
    I am using Pramati Studio 3.5
    Its urgent!!!
    Regards,
    Deepa Datar

    problem 2:
    either translate all < en > into < and > or display the XML in a textarea

  • Problem including a jsp in edit mode

    Hello
    Somehow i have a problem while including a jsp page while displaying the edit mode.
    If my doEdot just writes something like "Hello World" into the response it just works fine.
    But if i try to include a jsp resource the problems start to arise:
    1. The normal resource lookup request.getResource(IResource.JSP, bla) returns an unavailable resource. This seems the be because although a working instance of my portlet is used, the passed request  belongs to another context.
    2. Passing a precomputed resource seems to work, the page definitly gets called (-> it gets compiled and no errors show in stacktrace), but a sap dialog shows, saying that no properties exist, that can get configured cry
    I even stripped the jsp page to the single line "Hello", it gets compiled, but not shown!?
                                                                                    edit: After the dialog a new dialog is shown sayin:  The specified root item cannot be retrieved from the configuration. Correct the entry before trying again
    Even IF my confoguration is wrong (higly possible), why does it only show when using include but not while writing directly into the response stream?
    Solution:
    Portlet gets called via doEdit and thus is in edit mode. Since jsp pages extend AbstractPortalComponent the service method does not serve via the doContent method but tries to call doEdit on itself. Since jsp pages usually do not define doEdit, the default edit behavior gets applied.
    Set Default mode within the request type and the request node.
    Message was edited by: Mark Vollmann

    Thank you it worked .I really doesn't have much experience in the front end.
    Thank you once again.
    I ahve another problem , this is alomst the same , here i have a html anchor when user clicks on that link i wnat to display the result in the same window , but it is displaying in the new window , it does not have frames , so i can not say target .
    here is the code , please give me advice
    <table>
    <tr>
    <td><jsp:include page="top.jsp" /></td>
    </tr>
    <tr>
    <td align="left" valign="top" width="50%"><jsp:include page="paneltranscripts.jsp" /></td>
    <td width="50%"><center>
    <%
    if(transcripts.length == 0)
    out.println("<h2>No Transcripts Avialable</h2>");
    else
    { %>
    <% out.println("You are viewing at ");%> <b> <%= roomname%> </b> <% out.println("room transcripts"); %>
    <br>
    <% out.println("To <b>view</b> the transcripts click on the link"); %>
    <br>
    <% out.println("To <b>download</b> the transcripts right click on the link, open it in new window and save the page"); %>
    <br>
    <br>
    <%
         for(int i=0;i<=transcripts.length-1; i++)
              if(transcripts.equals(""))
                   continue;
              else
              %>
                   <a href="/DigiChat/DigiClasses/Resources/<%= sitename%>/Transcripts/<%= roomname%>/<%= realtranscripts[i%">"><%= transcripts[i] %></a>
                   <br>
                   <br>
              <%
    %>
    </td>
    </tr>
    </table>
    When user clicks on the transcripts[i] i want to display the result in the same window.
    Thank you</a>

  • Request Dispatcher error when forwarding

    hi all,
    I am using tomcat 4.1.24 and jdk1.3.1. I am having one servlet and one jsp. Servlet handles the submitted form and then for presentation logic it sends request to jsp page. I have servlet mapping properly defined in the web.xml and servlet url is /servlet/UploadImage. In this servlet I have used Requestdispatcher for forwarding the request to the jsp page the jsp page url is /jsp/ScanMessage.jsp. But while request is getting forwarded its throwing the exception as follows. I have not written any statement called out.println() in the servlet, even I am not geting object of PrintStream or Writer.
    Please Help me.
    Regards
    vivek
    The exception is
    2003-09-16 10:32:50 ApplicationDispatcher[] Servlet.service() for servlet jsp threw exception
    org.apache.jasper.JasperException: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
    at UploadImage.processRequest(UploadImage.java:91)
    at UploadImage.doPost(UploadImage.java:105)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.ajp.tomcat4.Ajp13Processor.process(Ajp13Processor.java:466)
    at org.apache.ajp.tomcat4.Ajp13Processor.run(Ajp13Processor.java:585)
    at java.lang.Thread.run(Thread.java:479)
    ----- Root Cause -----
    javax.servlet.ServletException: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.
    at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:536)
    at org.apache.jsp.ScanMessage_jsp._jspService(ScanMessage_jsp.java:506)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
    at UploadImage.processRequest(UploadImage.java:91)
    at UploadImage.doPost(UploadImage.java:105)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.ajp.tomcat4.Ajp13Processor.process(Ajp13Processor.java:466)
    at org.apache.ajp.tomcat4.Ajp13Processor.run(Ajp13Processor.java:585)
    at java.lang.Thread.run(Thread.java:479)

    * Servlet.java
    * Created on August 28, 2003, 11:09 AM
    import javax.servlet.*;
    import javax.servlet.http.*;
    import post.util.PropertyFile;
    import post.beans.ImageFiles;
    import java.io.File;
    import java.io.IOException;
    import com.oreilly.servlet.*;
    * @author vivek
    * @version
    public class UploadImage extends HttpServlet
    /** Initializes the servlet.
    public void init(ServletConfig config) throws ServletException
    super.init(config);
    /** Destroys the servlet.
    public void destroy()
    /** Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
    * @param request servlet request
    * @param response servlet response
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, java.io.IOException
    try
    HttpSession session = request.getSession();
    String userId = (String)session.getAttribute("LoginID");
    String sessionId = (String)session.getId();
    String rootPath = PropertyFile.getProperty("RootDirectoryPath");
    String uploadDirectoryPath = PropertyFile.getProperty("MailUploadDirectory");
    String path = rootPath + "/" + uploadDirectoryPath + "/" + userId + "/" + sessionId + "/";
    File filePath = new File(path);
    RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/jsp/ScanMessage.jsp");
    if(!filePath.exists())
    filePath.mkdirs();
    MultipartRequest fileRequest=null;
    try
    System.out.println("Brfore file saving");
    fileRequest = new MultipartRequest(request,path.trim(),2*1024*1024);
    System.out.println("Brfore file saving");
    catch(IOException ioe)
    request.setAttribute("ReturnedValue","MaximumSizeReached");
    dispatcher.forward(request,response);
    java.util.Enumeration uploadedFiles = fileRequest.getFileNames();
    String file = fileRequest.getFilesystemName((String) uploadedFiles.nextElement());
    System.out.println(file);
    if(file != null)
    ImageFiles files = (ImageFiles)session.getAttribute("UploadedImages");
    if(files == null)
    files = new ImageFiles();
    files.setFilePath(path);
    files.add(file);
    if(session.getAttribute("UploadedImages") == null)
    session.setAttribute("UploadedImages",files);
    System.out.println("added UploadedImages to session");
    request.setAttribute("ReturnedValue","Done");
    dispatcher.forward(request,response); //here the exception is thrown
    catch(Exception e)
    e.printStackTrace();
    /** Handles the HTTP <code>POST</code> method.
    * @param request servlet request
    * @param response servlet response
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, java.io.IOException {
    processRequest(request, response);
    /** Returns a short description of the servlet.
    public String getServletInfo() {
    return "Short description";

  • Tomcat can't get the specified jsp-page.

    there are three jsp-page : Step1.jsp Step2.jsp Step3.jsp
    Step2.jsp and Step3.jsp are placed at the same folder,but Step3.jsp is placed at the different folder.
    Step1.jsp's content :
    request.getRequestDispatcher("/CH4/Step2.jsp").forward(request,response);
    Step2.jsp's content :
    <form name="form1" action="Step3.jsp" method="post">
    <input type="submit" name="submit" value="submit">
    </form>
    Step3.jsp's content :
    <c:out value="can you see this page " />
    the expectent procedure is : Step1 -> Step2 ->Step3
    but there is error : The requested resource (/CH4/MyJspCode/Step3.jsp) is not available.
    how to currect it ?

    The action on your form will be relative to step1.jsp
    So it will look for step3.jsp in the same folder as step1.jsp.
    This is because:
    The request was for step1.jsp
    The action attribute is a relative reference, not absolute, and thus is relative to the requested url - step1.jsp
    Although it was forwarded to step2.jsp, the browser knows nothing of this, and thus uses step1.jsp as its base.
    You can change this by including a base tag on the page.
    You can also give an absolute reference to the servlet/jsp but that involves harcoding the context name into the URL.

  • Request dispatch problem

    To all
    The problem is that my request dispatching is not forwarding the request and I haven't got a clue why. I have a upload servlet which is working fine as it parses the request and the forwards you to the same jsp page or the next jsp page according to what values it extracts. However I have set up a bean to display the contentType() of each request which is sent to it from the jsp pages, however nothing is displayed when the request is forwarded from the upload servlet. this is what is happening .....
    public class upload extends HttpServlet {
    public void doPost( HttpServletRequest req, HttpServletResponse res ) throws ServletException, IOException {
    HttpServletRequest request = _req;
    HttpServletResponse response = _res;
    parseMultiForm pMF = new parseMultiForm( _req );
    Hashtable values = new Hashtable();
    String param;
    while ( ( param = pMF.getNextParameter()) != null) {
    String value = pMF.getParameter();
    values.put(param, value);
    if (values.containsKey("submit")) {
    String url = (String) values.get("reload");
    RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/" + url);
    dispatcher.forward(request, response);
    if (values.containsKey("continue")) {
    String url = (String) values.get("next");
    RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/" + url);
    dispatcher.forward(request, response);
    The above servlet forwards the request to a jsp which does the following....
    <jsp:useBean id="info" scope="session" class="InfoBean" />
    <jsp:setProperty name="info" property="request" value="<%= request %>" />
    However infoBean does not receive anything when the request is forwarded from the servlet??
    Can anyone see anything obviously wrong?? is it to do with the JSP asking for the <%= request> and not receiving it because the request dispatcher has altered it in some way?
    Thanks in advance anyone
    Andy.

    I have exactly the same problem. I can�t make the servlet pass the request object to the target jsp.
    Try not changing the request nor the response. Unfortunatelly due to the kind of job i do inside my servlet there's no way i can't touch the request. So if you can make it work with mi advice please let me know.

Maybe you are looking for