URL of servlet in AC_FL_RunContent?

The instructions I read for using AC_FL_RunContent, say to leave off the file extension of the swf file, e.g.:
AC_FL_RunContent(..., 'movie', 'some');
So that it will embed some.swf. However, I need to serve the swf from a servlet, e.g. /blah/SomeServletName. How can I do that?
I tried changing the javascript of AC_RunActiveContent.js, so it doesn't manipulate the file extension. In other words, so I could use:
AC_FL_RunContent(..., 'movie', 'some.swf');
But, it displays nothing if I use the servlet path, instead of a path that looks like a file name, e.g.:
AC_FL_RunContent(..., 'movie', '/blah/SomeServletName');
Can this be done?

The problem was that the servlet was setting Content-Disposition to attachment. Without that, as long as the AC_RunActiveContent.js is changed to not add a file extensions (what was the point of that?), then it works.

Similar Messages

  • BSP Exception: Access to URL /irj/servlet/prt/portal/prtroot/com.sap.ip.bi.web.portal.integration.launcher;jsessionid= not allowed

    Dear all,
    I've created out BI system in our new Portal installation and tested the connection. Everything works fine. I added the certificate of the portal to STRUSTSSO2 in BI ABAP and assigned SAP_ALL and SAP_NEW to my Account.in BI. If I open the iView from the portal I get a BSP Exception with the message:
    The used connection by the iView is to the ABAP-Stack of the BI-system not to the JAVA-Stack. Is that correct?
    BSP Exception: Der Zugriff auf die URL /irj/servlet/prt/portal/prtroot/com.sap.ip.bi.web.portal.integration.launcher;jsessionid=IDBYatWIpt_pX4uc52ChoZqMWkm1RAFW2qsA_SAP ist untersagt.
    What can be the problem/reason?
    Thanks!

    Hi Gerrit
    In both places you have to provide a authorization access to the end users then only it will work. because your are already said that in SAP_All & SAP_New working fine
    Back end BI system access as per the word document as pasted the link
    https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=7&cad=rja&uact=8&ved=0CFIQFjAG&url=http%3A%2F%2Fbasisdsp.f…
    For SAP portal you have to create iview's assign the same to end user
    Assigning an Authentication Scheme to an iView - User Authentication and Single Sign-On - SAP Library
    Portal Authentication Infrastructure - Configuring the Portal for Initial Use - SAP Library
    BR
    SS

  • FRM-92052 error... unable to connect to server URL /forms/servlet;

    Hi all.
    I'm on forms 11g 11.1.2.1.0
    I'm configuring my form and when I try to run it I have this error:
    FRM-92052: unable to connect to server at URL /forms/servlet;
    I have start up weblogic server and everything is ok.
    When I try to run my form I have the error.
    How can I solve it?
    Thanks all for collaboration,
    Fabrizio

    I open my log file and I copy here error section:
    java.lang.NoSuchMethodError: oracle/forms/net/ConnectionException.<init>(ILjava/lang/String;Ljava/lang/Throwable;)V
         at oracle.forms.servlet.BaseServlet.getConnectionException(Unknown Source)
         at oracle.forms.servlet.BaseServlet.logException(Unknown Source)
         at oracle.forms.servlet.ListenerServlet$Request.getRunformSession(Unknown Source)
         at oracle.forms.servlet.ListenerServlet$Request.getInfo(Unknown Source)
         at oracle.forms.servlet.ListenerServlet$Request.doGet(Unknown Source)
         at oracle.forms.servlet.ListenerServlet$Request.access$100(Unknown Source)
         at oracle.forms.servlet.ListenerServlet.doGet(Unknown Source)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
         at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
         at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
         at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3730)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3696)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2273)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1490)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
    >
    ####<5-feb-2013 14.42.40 CET> <Notice> <Diagnostics> <missuri377> <AdminServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <2e61ea05cba29510:6243aa29:13caa961585:-8000-0000000000000024> <1360071760720> <BEA-320068> <Watch 'UncheckedException' with severity 'Notice' on server 'AdminServer' has triggered at 5-feb-2013 14.42.40 CET. Notification details:
    WatchRuleType: Log
    WatchRule: (SEVERITY = 'Error') AND ((MSGID = 'WL-101020') OR (MSGID = 'WL-101017') OR (MSGID = 'WL-000802') OR (MSGID = 'BEA-101020') OR (MSGID = 'BEA-101017') OR (MSGID = 'BEA-000802'))
    WatchData: DATE = 5-feb-2013 14.42.40 CET SERVER = AdminServer MESSAGE = [ServletContext@6140131[app:formsapp module:forms path:/forms spec-version:2.5 version:11.1.2]] Root cause of ServletException.
    java.lang.NoSuchMethodError: oracle/forms/net/ConnectionException.<init>(ILjava/lang/String;Ljava/lang/Throwable;)V
         at oracle.forms.servlet.BaseServlet.getConnectionException(Unknown Source)
         at oracle.forms.servlet.BaseServlet.logException(Unknown Source)
         at oracle.forms.servlet.ListenerServlet$Request.getRunformSession(Unknown Source)
         at oracle.forms.servlet.ListenerServlet$Request.getInfo(Unknown Source)
         at oracle.forms.servlet.ListenerServlet$Request.doGet(Unknown Source)
         at oracle.forms.servlet.ListenerServlet$Request.access$100(Unknown Source)
         at oracle.forms.servlet.ListenerServlet.doGet(Unknown Source)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
         at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
         at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
         at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3730)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3696)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2273)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1490)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
    SUBSYSTEM = HTTP USERID = <WLS Kernel> SEVERITY = Error THREAD = [ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)' MSGID = BEA-101017 MACHINE = missuri377 TXID = CONTEXTID = 2e61ea05cba29510:6243aa29:13caa961585:-8000-0000000000000022 TIMESTAMP = 1360071760564
    WatchAlarmType: AutomaticReset
    WatchAlarmResetPeriod: 30000
    >
    How can I solve my problem?
    Thanks all for collaboration,
    Fabrizio

  • How to redirect url in servlet?

    in servlet, i want to redirect page to a url which not in same container, and send to some information to this url, what shall i do?
    thanks.

    duffymo's solution should do it, then.
    You could build on top of that and send serialized data (I'm assuming your data is serializable) over the wire to the other server using an HttpUrlConnection and ObjectOutputStream's writeObject(), and read it at the other end with ObjectInputStream's readObject(). For example for the write operation :
    URL url = new URL(other_server_url);
    HttpURLConnection urlcon = (HttpURLConnection)url.openConnection();
    // after setting urlcon attributes like requestMethod to POST etc...
    ObjectOutputStream out = new ObjectOutputStream(urlcon.getOutputStream());
    // now write the data, then flush & close the connection
    ...If the amount if data to transfer is quite large, you could again build on top of the above and use CompressedSerialization :
    http://robowiki.dyndns.org/perl/robowiki?CompressedSerialization

  • How to return URL of servlet path ?

    Hello,
    I want to return the URL of current servlet path (such as "http://www.mydomain.com:888/servlet"). How can I do that ?
    thanks in advance...

    Hi danisment,
    Checkout the API for javax.servlet.http.HttpServletRequest Interface in which you have the methods to get path information.
    Use
    request.getServletPath();Returns the part of this request's URL that calls the servlet. This includes either the servlet name or a path to the servlet, but does not include any extra path information or a query string.
    If you want the entire URL,
    use request.getRequestURL(); returns the StringBuffer
    The returned URL contains a protocol, server name, port number, and server path, but it does not include query string parameters
    Hope this will throw some light for you problem.
    Thanks,
    Sanath Kumar

  • Calling URL from servlet

    Hi!
    I am trying to find a solution to this scenario:
    1) A cron job will call a servlet.
    2) Servlet calls a URL on remote server.
    3) Remote server returns an XML document.
    4) Servlet processes/parses the XML document.
    5) Servlet stores XML fields into DB.
    6) Servlet response (entry to log file) indicates status of transaction.
    I'm stuck @ #2. What mechanism can I use to make a call to remote URL? I do not want the returning XML document to display on the client's browser; I want to process it on the back-end.
    Thx!

    http://java.sun.com/docs/books/tutorial/networking/urls/readingURL.html

  • Calling simple URL from servlet.

    Hello,
    i need your help. I must call a simple URL (for example) "www.sun.com" from my servlet. How can i do this ? Sorry for stupid question, but i don't know how...
    Dmitri.

    I didn't know, Lgmqy2000, that i can delete "Duke"....... i tried to cancel it, but without results...
    Dmitri

  • Open a URL from Servlet

    Hi,
              I'm running a servlet and wants to open a URL for a file, how do I do that ?
              (To get the same effect as if I open the file from a browser)
              thanks in advance..
              ..Per
              

    If you mean to read the contents of a URL, then see URL.getConnection. If
              you mean to download a file to a browser, then search this newsgroup for
              "download".
              Cameron Purdy
              Tangosol, Inc.
              http://www.tangosol.com
              +1.617.623.5782
              WebLogic Consulting Available
              "Per Lovdinger" <[email protected]> wrote in message
              news:3a9a7650$[email protected]..
              > Hi,
              >
              > I'm running a servlet and wants to open a URL for a file, how do I do that
              >
              > (To get the same effect as if I open the file from a browser)
              >
              > thanks in advance..
              > ..Per
              >
              >
              

  • Get "#"  from URL into servlet

    Hi
    I am writing a servlet which can check that the requested URL is having "#" or not.?
    Let's say my URL is like, http://abc.com/#/efg/hij.jsp
    As it is having "#' sign in the URL string, So I need to check the existence of "#" in requested URL.
    My problem is when I write ..
    StringBuffer url = request.getRequestURL();
    String requestedURL = url.toString();
    requestedURL only provides me the string before "#" i.e. http://abc.com/
    I need to check if it has "#" or not with whole URL string.
    Is there any way to check that into servlet.?

    The # sign is a client side sign telling it to go to a bookmark with the name following the # sign. The # sign is not part of the requested URL, so you can't get it on the server side.
    If you are generating URLs with the # sign and trying to make it do something you should re-think the design since the # sign is reserved for client side use.
    Alternatively you could try to pass any URL that does have the # sign through java.net.URLEncoded.encode(theURL, "UTF-8") to see if you can then get it back on the server.

  • Not able to dispatch to an URL from servlet

    Hi ,
    I am trying to call a URL from a servlet, which is running in an oc4j instance of Oracle AS 10.1.2.0.2
    My servlet (session_servlet) basically reads the session id, whenever it is accessed. It then inserts this session id into a table in an oracle database. Then, I want to access my Oracle Forms application from session_servlet, by dispatching to the URL, say
    http://<my_host>/forms/frmservlet?config=test&session_id=<the_session_id_read_by_session_servlet>
    session_servlet and frmservlet are running on the same Oracle AS, but on different http servers, session_servlet on port 7777 and frmservlet on the default 80.
    <code snippet of my session_servlet, where I am dispatching to the URL>
    getServletContext().getRequestDispatcher("http://<my_host>/forms/frmservlet?config=test&session_id="+session.getId()).forward(request,response);
    But am getting the following error
    500 Internal Server Error
    java.lang.NullPointerException
    at session_tracker.doGet(session_tracker.java:54)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:826)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:332)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:224)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:133)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
    at java.lang.Thread.run(Thread.java:534)
    Can someone please help me on this.
    Thanks,
    Suresh

    getServletContext().getRequestDispatcher("http://<my_host>/forms/frmservlet?config=test&session_id="+session.getId()).forward(request,response)
    From the Javadocs for ServletContext.getRequestDispather():
    http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/ServletContext.html#getRequestDispatcher(java.lang.String)
    The pathname must begin with a "/" and is interpreted as relative to the current context root. Use getContext to obtain a RequestDispatcher for resources in foreign contexts. This method returns null if the ServletContext cannot return a RequestDispatcher.
    -steve-

  • Pass URL to servlet

    Hi,
    I am new to servlet . I am facing a small issue. I have to pass the url to the servlet. For Example: if user clicks http://myservername:7001/QbpmWeb/servlet/imageServlet?taskInstanceId=304
    then in the servlet, i need the myservername and port number. How to get the info?
    Thanks in advance
    Pankaj

    hi :-)
    what application server you are using?
    if its tomcat, it includes some nice examples in there.
    out.println("Request URI: " + request.getRequestURI());will output
    /servlets-examples/servlet/RequestInfoExample
    to get additional info you can use this
    import java.io.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class RequestHeaderExample extends HttpServlet {
        public void doGet(HttpServletRequest request, HttpServletResponse response)
        throws IOException, ServletException
            response.setContentType("text/html");
            PrintWriter out = response.getWriter();
            Enumeration e = request.getHeaderNames();
            while (e.hasMoreElements()) {
                String name = (String)e.nextElement();
                String value = request.getHeader(name);
                out.println(name + " = " + value);
    }will output:
    accept image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */*
    referer http://localhost:8080/servlets-examples/
    accept-language en-us
    accept-encoding gzip, deflate
    user-agent Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
    host localhost:8080
    connection Keep-Alive
    codes and example above are included on tomcat.
    if your using tomcat you can check the example by
    visiting the url
    http://localhost:8080/servlets-examples/
    regards,

  • Submit URL to Servlet from javaBean

    I am trying to make a call to servlet through URL in my javabean and its not working out. calculateFedexRates class is working fine. If I call the same servlet from oracle PL/sQL package using util_http packge, it works just fine. But here in java bean I get error as follows:
    I just dont know what is wrong am I doing? Please help.
    Thanks.
    here is my java bean.
    ---------------------public class submiturltoservlet {
    public static void main(String[] args) {
                                    try {
                                    String data = URLEncoder.encode("ds", "UTF-8") + "=" + URLEncoder.encode("0", "UTF-8");
                                            data += "&" + URLEncoder.encode("weight", "UTF-8") + "=" + URLEncoder.encode("10.03", "UTF-8");
                                    data += "&" + URLEncoder.encode("fromState", "UTF-8") + "=" + URLEncoder.encode("IL", "UTF-8");
                                    data += "&" + URLEncoder.encode("fromZip", "UTF-8") + "=" + URLEncoder.encode("60133", "UTF-8");
                                    data += "&" + URLEncoder.encode("toState", "UTF-8") + "=" + URLEncoder.encode("IL", "UTF-8");
                                    data += "&" + URLEncoder.encode("toZip", "UTF-8") + "=" + URLEncoder.encode("60601", "UTF-8");
                                    data += "&" + URLEncoder.encode("shipDate", "UTF-8") + "=" + URLEncoder.encode("2009-02-05", "UTF-8");
                                    URL url = new URL("myurl/fedex/getFedexRates?weight=10.03&fromState=IL&fromZip=60133&toState=IL&toZip=60601&shipDate=2009-02-05");
                                    URLConnection conn = url.openConnection();
                                    conn.setDoOutput(true);
                                    ((HttpURLConnection)conn).setRequestMethod("GET");
                                    conn.setUseCaches(false);
                                    OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
                                    wr.write(data);
                                    wr.flush();
                                   BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
                                   String line;
                                   while ((line = rd.readLine()) != null) {
                                        System.out.println("Response: " + line);
                                   wr.close();
                                   rd.close();
                                } catch (Exception e) {
                                    System.out.println("print out a stack trace and exit");
                                            e.printStackTrace();
            } // end of main
    }               // End of class
    here is my servlet.
    public class getFedexRates extends HttpServlet {
        public void init() {
        public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
           String weight = request.getParameter("weight");
               String fromState= request.getParameter("fromState");
               String fromZip= request.getParameter("fromZip");
               String toState= request.getParameter("toState");
               String toZip= request.getParameter("toZip");
               String shipDate= request.getParameter("shipDate");
               calculateFedexRates calculatefedrate = new calculateFedexRates();
            response.setContentType("text/plain");
            PrintWriter out = response.getWriter();
            out.println(calculatefedrate.calculate(weight,fromState,fromZip,toState,toZip, shipDate));
            out.close();
            out.flush();
            public void destroy() {
    Error I get :
    java.io.IOException: Server returned HTTP response code: 405 for URL: http://myurl/fedex/getFedexRates?weight=10.03&fromState=IL&fromZip=60133&toState=IL&toZip=60601&shipDate=2009-02-05
            at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:800)
            at submiturltoservlet.main(submiturltoservlet.java:34)

    HTTP status code 405 means "method not allowed". So the other side doesn't support GET or POST request.
    I am not sure what the request method is after all. The setDoOutput(true) triggers POST, but you're forcing it to GET afterwards. Why this? It look like that you rather want a GET, so leave the setDoOutput(true) away and that other line too. If it still returns a 405, then you should probably be using POST rather than GET. In this case use setDoOutput(true) and write the query string to the body of the request rather than in URL.

  • Get base URL during servlet init()

    How can I obtain a Application Server's base URL during a servlet's init(), i.e. not using HttpServletRequest later
    e.g. for servlet test accessible at http://localhost:8080/contextroot/test
    base URL = "http://localhost:8080/contextroot/"
    After some testing the closest I've got is "jndi:/server/contextroot/". Can I get a HTTP URL from this?
    public void init(ServletConfig config) throws ServletException {
    super.init();
    try {
    path = config.getServletContext().getResource("/");
    } catch (Exception e) {
    System.out.println("e: " + e.toString());
    Any ideas appreciated. Thanks in advance.
    Java EE 5

    All what you have in the init() method is the ServletConfig. Have you checked its javadoc to see what it all offers?
    [http://java.sun.com/javaee/5/docs/api/javax/servlet/ServletConfig.html]. Hint: check the other getters of ServletContext.

  • URL on servlet

    I have a servelt called "/order", it will process some data, after it finish processing those data, it will do this:
    target = "/order.jsp";
    RequestDispatcher rd;
    rd = getServletContext().getRequestDispatcher(target);
    rd.forward(req,res);
    which I want to forward the paget to "/order.jsp", a jsp page, not a servlet.
    But after the browser forward to new jsp page, the URL will not change to the jsp's address(in this case,"order.jsp"), it still shows the servlet URL.
    What should I do to make browse shows current page URL?
    Thanks

    The browser makes a request to the order servlet. On the server the order does a forward to the order.jsp which then returns to the browser. But the browser has no knowledge of what occured on the server so will display the url that it sent the request to which is the order servlet.
    The only way to get the browser to dispaly the order.jsp url is to do a sendRedirect or the html/javascript equivalent.
    However before you do that ask yourself the question: what happens if the user bookmarks the order.jp url? If the user were to go directly to order.jsp can the jsp handle it gracefully?

  • Redirecting URL Servlet not working

    Hi all,
    All my JSPs are located in pages folder of my Application's Web Context. I need to redirect JSP URLs to the pages folder. For example if user requests http://localhost:8080/RedirectJSPApp/test.jsp then I need to redirect to http://localhost:8080/RedirectJSPApp/pages/test.jsp. But if user request http://localhost:8080/RedirectJSPApp/pages/test.jsp then i dont need to do any redirection.
    So I define a Servlet:
    package com.srh.servlet;
    public class RedirectServlet
          extends javax.servlet.http.HttpServlet
       public void doGet(HttpServletRequest request, HttpServletResponse response)
             throws ServletException, IOException
          doPost(request, response);
       public void doPost(HttpServletRequest request, HttpServletResponse response)
             throws ServletException, IOException
          String contextPath = request.getContextPath();
          String requestUrl = request.getRequestURL().toString();
          String targetRequestUrl = null;
          String jspRequested = null;          
          int index = -1;
          index = requestUrl.indexOf("/pages/");
          // The JSP is not called properly;
          if (index == -1)
             // Call the JSP properly
             index = requestUrl.indexOf(contextPath);
             if (index != -1)
                targetRequestUrl = requestUrl.substring(0, index+contextPath.length());
                jspRequested = requestUrl.substring(index+contextPath.length()+1);
                targetRequestUrl += "/pages/" + jspRequested;
                response.sendRedirect(targetRequestUrl);
    }In the web.xml I wrote:
       <servlet>
          <description>This Servlet redirects JSP URLs to appropriate lcoation w.r.t. Server</description>
          <display-name>RedirectServlet</display-name>
          <servlet-name>RedirectServlet</servlet-name>
          <servlet-class>com.srh.servlet.RedirectServlet</servlet-class>
       </servlet>
       <servlet-mapping>
          <servlet-name>RedirectServlet</servlet-name>
          <url-pattern>*.jsp</url-pattern>
       </servlet-mapping>I have a test.jsp in pages folder:
    <html>
       <head>
          <title>Test</title>
       </head>
       <body>
          Inside test.jsp
       </body>
    </html>I deployed on JBoss 4.2.0. I type http://localhost:8080/RedirectJSPApp/test.jsp in my browser and it changes to http://localhost:8080/RedirectJSPApp/pages/test.jsp which is perfect but it never prints "Inside test.jsp" on the page. Why this is happening?
    If I remove RedirectServlet entries from web.xml and just type in http://localhost:8080/RedirectJSPApp/pages/test.jsp then it prints "Inside test.jsp" on the page. What I am missing here?
    TIA
    TV

    I tried forward of RequestDispatcher but still same problem:
    package com.srh.servlet;
    public class RedirectServlet
          extends javax.servlet.http.HttpServlet
       public void doGet(HttpServletRequest request, HttpServletResponse response)
             throws ServletException, IOException
          doPost(request, response);
       public void doPost(HttpServletRequest request, HttpServletResponse response)
             throws ServletException, IOException
          String contextPath = request.getContextPath();
          String requestUrl = request.getRequestURL().toString();
          String targetRequestUrl = null;
          String jspRequested = null;          
          int index = -1;
          index = requestUrl.indexOf("/pages/");
          // The JSP is not called properly;
          if (index == -1)
             // Call the JSP properly
             index = requestUrl.indexOf(contextPath);
             if (index != -1)
    //          targetRequestUrl = requestUrl.substring(0, index+contextPath.length());
    //          jspRequested = requestUrl.substring(index+contextPath.length()+1);
    //          targetRequestUrl += "/pages/" + jspRequested;
    //          response.sendRedirect(targetRequestUrl);
                jspRequested = requestUrl.substring(index+contextPath.length()+1);
                RequestDispatcher rd = request.getRequestDispatcher("/pages/" + jspRequested);
                rd.forward(request, response);
    }

Maybe you are looking for