HTTP/Servlet problem

Hi,
This question may sound a little bit stupid but i 'm new with HTML and servlets...
I am trying to do the following:
I have a FORM: <FORM NAME=\"form\">
in which there is a button:
<INPUT TYPE="BUTTON" NAME="searchSession" VALUE="Search" onClick="openWindow('searchSession');">
openWindow is a java script in which a new window is created:
newWindow = window.open('http://"+hostName+":8080/servlet/be.abis.presentation.EnrolmentServlet', 'Select Session', 'menubar,scrollbars,resizable,width=628,height=333');
in the servlet (EnrolementServlet) the request will be forwarded to a specific servlet. This happens through the following code:
if(request.getParameter("searchSession") != null){
          requestDispatcher = getServletConfig().getServletContext().getRequestDispatcher("http://"+hostName+":8080/servlet/be.abis.presentation.SearchSessionServlet");
     }else if(request.getParameter("ok") != null){
          enrolmentBean.saveEnrolment();
     }else{
          createForm(request, response);
     if(requestDispatcher != null){
          requestDispatcher.forward(request, response);
what i do not understand is why the request is never forwarded to: http://"+hostName+":8080/servlet/be.abis.presentation.SearchSessionServlet
I 'll rally be thankful if someone could help me out of heren
thnx
PS: Session here has nothing to do with HTTPSession

I am doing the same thing and it do work.
my Javascript looks like following
function OpenNewWindow(url,title)
window.open(url, title, "width=650,height=400,status=yes,resizable=yes,toolbar=yes,status=yes,scrollbars=yes,location=yes,screenX=0,left=0,screenY=0,top=0");
Make sure your host name is right.
Hope this help!!

Similar Messages

  • HTTPS Servlet requests

              After installing service pack 9 from WL5.1, HTTPS servlet requests result in the
              browser returning a server error. Issue 41888 of sp9 seems to address this. We
              were previously running service pack 6 and didn't experience this problem. Any
              ideas?
              

    Have you installed SP9 properly?
              I just tried accessing example servlets on Https protocol and i don't see any
              errors.
              Could you tell us what problems you are facing? Any test case?
              Kumar
              Darren Collins wrote:
              > After installing service pack 9 from WL5.1, HTTPS servlet requests result in the
              > browser returning a server error. Issue 41888 of sp9 seems to address this. We
              > were previously running service pack 6 and didn't experience this problem. Any
              > ideas?
              

  • How can i send xml file with a http servlet request

    Hi
    Please tell me how can I send a xml file into http servlet request.
    I have a servlet(action) java file.From this servlet I have generate a xml file. Now I need to send that xml file to another servlet with http servlet request object.
    Dave.

    When you say you have generated an XML file what do you mean?
    Is it a file stored on disk? Then pass the file path as a string to the servlet.
    Is it stored in memory as an object? The pass a reference to the object to the servlet.
    Or are you asking how to communicate between servlets?
    Look in the JavaDocs for the RequestDispatcher class. You can use this class to forward the request to another servlet. Data can be passes using the RequestDispatcher by storing it as attributes using the request getAttribute and setAttribute methods. Also described in the JavaDOcs.
    http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/RequestDispatcher.html

  • HTTP Servlet call

    Hi all,
    I have a BPM scenario where i have several conditional branches, and in one of the branch i have to make a HTTP Servlet call via HTTP adapter and pass some values from the incoming message in the HTTP post.
    Is this just like a normal HTTP adapter call or HTTP servlet is something diffrent from a normal adapter call?
    anybody has done similar HTTP servlet calls ? aplease share your thoughts.
    Thanks

    Hi,
    Its same to the normal HTTP Call but at the BPM you meight need to give conditions as you indicated...you give conditions in the Control step of BPM
    Amaresh

  • Non-HTTP servlet

              I need to support concurrent access from multiple clients using a non-HTTP protocol
              over socket connection. One way is to write my socket server and create a new
              thread for each request. But WLS forbids user-created threads from calling into
              WLS components such as EJB. So I would like to write a non-HTTP servlet so that
              the WLS servlet container will create a new thread calling into the servlet and
              have the servlet calling EJBs on this WLS created thread. But is there a way to
              plug a subclass of GenericServelt into WLS?
              Thanks,
              T Tse
              

    I don't think there is a way to use non-HTTP servlet's, but still you can use WLS
              execute queue and execute threads, for example:
              ServerSocket serverSocket = new ServerSocket(...);
              for(;;) {
              new MyThread(new RequestHandler(serverSocket.accept())).start();
              class RequestHandler implements Runnable {
              Socket socket;
              public RequestHandler(Socket socket) {
              this.socket = socket;
              public void run() {
              // to see if this is executing on a WebLogic execute thread
              new Exception().printStackTrace();
              try {
              socket.close();
              } catch(Throwable whatever) {}
              class MyThread implements Schedulable, Triggerable {
              boolean done = false;
              Runnable runnable = null;
              Object sync = new Object();
              ScheduledTriggerDef std;
              public void join() throws InterruptedException {
              synchronized(sync) {
              if(!done) {
              sync.wait();
              public void run() {
                   if(runnable != null) {
                   runnable.run();
              public MyThread() {
              public MyThread(Runnable runnable) {
                   this.runnable = runnable;
              public boolean start() {
                   boolean ok = false;
                   try {
                   T3ServicesDef t3 = (T3ServicesDef)(new InitialContext()).lookup("weblogic.common.T3Services");
                   std = t3.time().getScheduledTrigger(this, this);
                   std.schedule();
                   ok = true;
                   } catch(NamingException ne) {
                   System.out.println(ne.getMessage());
                   } catch(TimeTriggerException tte) {
                   System.out.println(tte.getMessage());
                   return ok;
              public void trigger(Schedulable sched) {
                   try {
                   run();
                   } catch(Throwable t) {
                   System.out.println(t);
              synchronized(sync) {
              done = true;
              sync.notify();
              public long schedule(long time) {
                   return done ? 0 : 1;
              ttse <[email protected]> wrote:
              > I need to support concurrent access from multiple clients using a non-HTTP protocol
              > over socket connection. One way is to write my socket server and create a new
              > thread for each request. But WLS forbids user-created threads from calling into
              > WLS components such as EJB. So I would like to write a non-HTTP servlet so that
              > the WLS servlet container will create a new thread calling into the servlet and
              > have the servlet calling EJBs on this WLS created thread. But is there a way to
              > plug a subclass of GenericServelt into WLS?
              > Thanks,
              > T Tse
              Dimitri
              

  • Non-http servlet engine?

    Hi, I'm new to servlet development and I'm not sure this question has been answered here before. So I apologize if it has.
    Basically I want to have an integrated server that can accept both http and non-http requests. So my initial thought was to write an HttpServlet and a GenericServlet. Then I googled for clues on how to implement that and found from the JavaRanch website http://faq.javaranch.com/java/ServletsFaq#otherProtocols that this task could be a daunting one because that'd imply that I have to write a new servlet engine.
    So my question is, is this true in your expert opinion? And, if the custom non-http protocol has a similar syntax as http (e.g. RTSP), is it possible to just extend the http servlet engine to support it? And would that be doable without much effort?
    Thanks,
    Liang.

    Would you actually need the entire servlet system for the new protocol? For your typical simple request/reply protocol you'd normally:
    Create a server socket.
    When a connection arrives, start a thread to service it.
    In the service thread, read and parse request.
    Send reply.
    Close socket, exit thread.
    A servlet system adds a bunch of stuff to that: a layer that allows you to configure pluggable request handlers; methdod-specific functions (POST -> doPost()); a ServletRequest object; etc. Are those things relevant to the new protocol? Do you have requests with URL-like things in the header, allowing routing requests to different servlets? Do you plan to have lots of servlets for the protocol (one servlet -> no much point in XML-configurable request routing)?
    I'd hope that I wouldn't need to implement a configurable request routing infrastructure. It's a lot of work if it's not really needed. Just write a socket server. If you have an associated web server (e.g. HTML pages from which the user starts RTSP requests) you can even run the socket server inside the servlet container if that helps.

  • QaaWS HTTP Servlet

    Hi All,
    Iam created a universe and qaaws query on the universe . Every thing is fine but while retrieving the QAAWS url into Xcelsius it showing unable to load URL . When iam paste URL on my Browser it is showing QaaWS HTTP Servlet(Input/Output exception occurred : 'C:\Program Files\Business Objects\Tomcat55\webapps\dswsbobje\WEB-INF\classes\qaawsWsdl.zip (The system cannot find the file specified)' )
    Thanks
    Praveen Yagnamurthy.

    Hi Chand,
    Check once WEbi server as well tomcat server in CMC ? Every thing is fine ask the basis guy weather he applied any patches in BO . If he applied the patches   just re produce the QAAws URl s i mean just choose your Created qaaws query Next >next>finish .DO the same for your QAAWS queries  it means that it will upgrade URLS to your Lower version to higher Version .

  • Doubt in Generic Servlet and Http Servlet

    Hi,
    I studied Genaric Servlet does not support state and session mengement and where as Http Servlet supports state and session mengement.
    Why Genaric Servlet does not support state and session mengement ?
    Can any one plz tell me reasons.

    GenericServlet is pretty much the most basic Java application that you can run server-side. It doesn't support much of anything except for the basic life cycle management and a couple other things. Go to Dictionary.com and lookup the word Generic. It's used a lot in software development. Go to http://java.sun.com/j2ee/1.4/docs/api/index.html to read more on the GenericServlet class.
    BalusC, because a thread hasn't been active in awhile doesn't mean it's dead. If it were dead it would not be editable. Moreover, the question was never answered (adequately).
    Edited by: wpafbuser1 on Jan 3, 2008 3:33 PM

  • Applet/Servlet/serialized objects/HTTPS/Intranet problem

    We've got a Webapplication with[b] applets on the client and servlets on the server side.The Applet send serialized Objects over HTTPS (SSL) to the servlet. The servlet does some business logic and send the answer the same way back.
    In all our tests and in the most cases the application works without any problems.
    But in some Intranet environments we get occasionally (not definitely reproducable) the following error:
    <Oct 1, 2004 8:26:00 AM>  [AnmeldenService] {Service-readThreadAks-AnmeldenServiceThread}
    java.io.EOFException: Expecting code
    at java.io.ObjectInputStream.peekCode(Unknown Source)
    at java.io.ObjectInputStream.readObject(Unknown Source)
    at java.io.ObjectInputStream.readObject(Unknown Source)
    at com.dsh.egb.aks.betrieb.rclt.service.ServiceThread$2.run(ServiceThread.java:222)
    at java.lang.Thread.run(Unknown Source)Has anybody an idea how to further analyse this problem?
    Thanks,
    Mark
    We use JRE/JDK 1.3.1_10.

    Here some more Information about our environment:
    Server: Apache 1.3.26 / Openssl 0.9.6d /WinNT 4.0 /HTTP Redirect to Tomcat 4.0.1/ JDK1.3.1_10/ WinNT 4.0
    Client: Plugin 1.3.1_10/Internet Explorer 6.0 (SSL)/Win NT 4.0

  • Problems with Http-servlet : UTF-8

    I am having some difficulty with UTF-8 encoded
    chracaters in a Java servlet.
    My servlet accepts an XML file conteining a question and returns an HTM page. The XML has cyrillic characters encoded as utf-8.. The rendering
    servelt copes with this fine, and the HTML produced
    displays OK in the browser (the response type on the
    Java servelet has to be set to "text/html;
    charset=UTF-8" for this to work).
    I have to send cyrillic characters back in the
    response to the question in a text field in the HTML form.The browser is
    correctly sending back the byte stream (which I am
    printing here as hex): d0b3d0bed180d0bed0b4 (this is a
    cyrillic word correctly coded as utf-8).
    However, on collecting the response (using
    request.getParameterValues(fieldname)) the servlet
    returns the byte stream: d0b3d0bed13fd0bed0b4.
    A mistake in the fifth byte.
    Can anyone help with this problem? Is there a known problem with the JAVA UTF-8 converter?
    Regards
    Graham

    I now know the answer to this problem thanks to Bruno Van Haetsdaele .
    Before calling request.getParameterValues(fieldname));
    one should call request.setCharacterEncoding("UTF-8");
    Hope that helps somebody else!

  • Problem whit http servlet!!

    How I can start my bundle from browser?
    I have installed ans started jes
    I have installed ans started all bundle whit command line in MS-DOS window , but I do not Know
    what I have to type in the bar-address of my browser to start the service.
    I Know only
    http://localhost:8080/ ....and than??...
    Help me!

    I'm also newbie of servlet.
    1st: what do you have installed? You need a server to run servlet as Tomcat (you can get it for free from http://jakarta.apache.org) and J2SE installed in your PC
    2nd: after you have installed the package above, just open your browser and write this url http://localhost:8080. If everything work right, you will see tomcat welcome page.

  • Mildet connect to oracle DB using servlet problem ,help please

    hi guys i have a problem am tring to connect my midlet to databse through midlet but i don`t know what is the problem so far the midlet already connect to my servlet url but the servlet cant read the parameters to open the connection for database
    my servlet code
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    import java.io.*;
    import java.net.*;
    import java.sql.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.text.*;
    * @author freddy
    public class getconnection extends HttpServlet {
        Statement statement;
    ResultSet rs=null;
    String bstr=null;
    String bstr1=null;
    String bstr2=null;
    public void init()
        * 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, IOException {
            response.setContentType("text/html;charset=UTF-8");
            PrintWriter out = response.getWriter();
            try {
                /* TODO output your page here
                out.println("<html>");
                out.println("<head>");
                out.println("<title>Servlet getConnection</title>"); 
                out.println("</head>");
                out.println("<body>");
                out.println("<h1>Servlet getConnection at " + request.getContextPath () + "</h1>");
                out.println("</body>");
                out.println("</html>");
            } finally {
                out.close();
        // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
        * Handles the HTTP <code>GET</code> method.
        * @param request servlet request
        * @param response servlet response
        @Override
        protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            processRequest(request, response);
      doPost(request,response);
        * Handles the HTTP <code>POST</code> method.
        * @param request servlet request
        * @param response servlet response
        @Override
        protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            processRequest(request, response);
            DataInputStream in = new DataInputStream(
                    (InputStream)request.getInputStream());
            String sid = in.readUTF();
            String user = in.readUTF();
            String pwd = in.readUTF();
          //  "jdbc:oracle:thin:@localhost:1521"+": "+sid
            String message = message = "Name:"+bstr+" telephone:"+bstr1+" burthday:"+bstr2;
             try {
                connect(sid,user, pwd);
                message += "100 ok connected";
            } catch (Throwable t) {
                message += "200 " + t.toString();
            response.setContentType("text/plain");
            response.setContentLength(message.length());
            PrintWriter out = response.getWriter();
            out.println(message);
            in.close();
            out.close();
            out.flush();
        private void connect(String sid, String user,String pwd)
        throws Exception {
            // Establish a JDBC connection to the MYSQL database server.
            //Class.forName("org.gjt.mm.mysql.Driver");
            Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
            Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:"+sid,user,pwd);
            System.out.print("connected");
            try{
               statement =conn.createStatement();
                rs=statement.executeQuery(" Select*from WOH.P_DEMGRAPHICS where P_ID='P1000 '");
            catch(SQLException e)
            System.err.print(e);
           try{
    while (rs.next()) {
    bstr=rs.getString(2);
    bstr1=rs.getString(3);
    bstr2=rs.getString(4);
    statement.close();
       catch (SQLException e) {
    //bstr += e.toString();
    System.err.println(e);
    System.exit(1);
            // Establish a JDBC connection to the Oracle database server.
            //DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
            //Connection conn = DriverManager.getConnection(
            //      "jdbc:oracle:thin:@localhost:1521:"+db,user,pwd);
            // Establish a JDBC connection to the SQL database server.
            //Class.forName("net.sourceforge.jtds.jdbc.Driver");
            //Connection conn = DriverManager.getConnection(
            //      "jdbc:jtds:sqlserver://localhost:1433/"+db,user,pwd);
        * Returns a short description of the servlet.
        public String getServletInfo() {
            return "Short description";
        // </editor-fold>
    }Midlet code
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    import java.io.*;
    import java.util.*;
    import javax.microedition.io.*;
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    * @author freddy
    public class testOrcl extends MIDlet  implements CommandListener {
       protected String url;
        private String username;
        private Display display;
        private Command exit = new Command("EXIT", Command.EXIT, 1);;
        private Command connect = new Command("Connect", Command.SCREEN, 1);
        private TextField tb;
        private Form menu;
        private TextField tb1;
        private TextField tb2;
        DB db;
        public testOrcl() throws Exception
            display=Display.getDisplay(this);
            url="http://localhost:8084/getConnection/getconnection";
        public void startApp() {
            displayMenu();
        public void displayMenu()
        menu= new Form("connect");
         tb = new TextField("Please input database: ","",30,
                    TextField.ANY );
            tb1 = new TextField("Please input username: ","",30,
                    TextField.ANY);
            tb2 = new TextField("Please input password: ","",30,
                    TextField.PASSWORD);
            menu.append(tb);
            menu.append(tb1);
            menu.append(tb2);
            menu.addCommand(exit);
            menu.addCommand(connect);
            menu.setCommandListener(this);
            display.setCurrent(menu);
        public void pauseApp() {
        public void destroyApp(boolean unconditional) { }
        public void commandAction(Command command, Displayable screen) {
            if (command == exit) {
                destroyApp(false);
                notifyDestroyed();
            } else if (command == connect) {
                db  = new DB(this);
                db.start();
                db.connectDb(tb.getString(),tb1.getString(),tb2.getString());
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    import java.io.*;
    import java.util.*;
    import javax.microedition.io.*;
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import java.lang.*;
    * @author freddy
    public class DB implements Runnable  {
        testOrcl midlet;
         private Display display;
            String sid;
            String user;
            String pwd;
            public DB( testOrcl midlet)
            this.midlet=midlet;
            display=Display.getDisplay(midlet);
        public void start()
        Thread t = new Thread(this);
                t.start();
        public void run()
         StringBuffer sb = new StringBuffer();
                try {
                    HttpConnection c = (HttpConnection) Connector.open(midlet.url);
                   c.setRequestProperty(
                       "User-Agent","Profile/MIDP-2.1, Configuration/CLDC-1.1");
                    c.setRequestProperty("Content-Language","en-US");
                    c.setRequestMethod(HttpConnection.POST);
                    DataOutputStream os =
                            (DataOutputStream)c.openDataOutputStream();
                    os.writeUTF(sid.trim());
                    os.writeUTF(user.trim());
                    os.writeUTF(pwd.trim());
                    os.flush();
                    os.close();
                    // Get the response from the servlet page.
                    DataInputStream is =(DataInputStream)c.openDataInputStream();
                    //is = c.openInputStream();
                    int ch;
                    sb = new StringBuffer();
                    while ((ch = is.read()) != -1) {
                        sb.append((char)ch);
               showAlert(sb.toString());
                    is.close();
                    c.close();
                } catch (Exception e) {
                    showAlert(e.getMessage());
         /* This method takes input from user like db,user and pwd and pass
                to servlet */
            public void connectDb(String sid,String user,String pwd) {
                this.sid = sid;
                this.user = user;
                this.pwd = pwd;
            /* Display Error On screen*/
            private void showAlert(String err) {
                Alert a = new Alert("");
                a.setString(err);
                a.setTimeout(Alert.FOREVER);
                display.setCurrent(a);
       

    Comment out process request or rewrite & move it to a position after you read the parameters and connect to the db. Decide where you want to write to the output stream. Also, you have some superfluous casting.
    I take it that you are using netbeans? If you debug and step through the code you will get an idea of the flow. The steps should be, midlet connects with POST, doPost is called, server reads parameters, server opens connection, executes query, releases/closes connection, and writes a response to the midlet.
    Some notes about the connect method; The scope of rs may cause problems. It is unlike you will have a valid result set if you have a problem with create statement or execute. Take a look at connection pooling and be mindful how the connections are opened, used, and closed; put all the important cleanup operations in a finally. Remove system.exit from your servlet. Actually I would suggest limiting the scope of all your vars;
    If you store the username, password, and sid on the midlet, you may have trouble updating the installation base if you need to change the values for any reason. Also, you have clients which contain your database u/p, susceptible to snooping and decompilation. Use the servlet to abstract the db from the client. And use a datasource (with connection pooling) for obtaining connections to db.

  • Servlet problem: (Shay Shmeltzer / Steve Muench / Frank Nimphius)

    Dear sirs... (Shay Shmeltzer / Steve Muench / Frank Nimphius)
    I hope you can give me an answer.
    I created an ADF UIX application using JDeveloper 10.1.2. I have created a servlet to download files. my problem is that it works just fine using jdeveloper, while when deployed into oracle application server it causes errors.i am calling this servlet by storing filename and data in the session, then sending redirect request to the browser.
    the servlet code is:
    package view;
    import java.io.OutputStream;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.PrintWriter;
    import java.io.IOException;
    public class FileDownload extends HttpServlet
    public void init(ServletConfig config) throws ServletException
    super.init(config);
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    try
    String DownloadFileName=(String) request.getSession().getAttribute("downloadfilename");
    byte data[]=(byte []) request.getSession().getAttribute("downloadfiledata");
    if (DownloadFileName==null)
    return;
    request.getSession().removeAttribute("downloadfilename");
    request.getSession().removeAttribute("downloadfiledata");
    response.setContentType("application/octet-stream");
    response.setHeader("Content-Disposition", "attachment;filename="+DownloadFileName);
    response.setContentLength(data.length);
    OutputStream OS=response.getOutputStream();
    OS.write(data);
    catch (Exception e)
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    try
    String DownloadFileName=(String) request.getSession().getAttribute("downloadfilename");
    byte data[]=(byte []) request.getSession().getAttribute("downloadfiledata");
    if (DownloadFileName==null)
    return;
    request.getSession().removeAttribute("downloadfilename");
    request.getSession().removeAttribute("downloadfiledata");
    response.setContentType("application/octet-stream");
    response.setHeader("Content-Disposition", "attachment;filename="+DownloadFileName);
    response.setContentLength(data.length);
    OutputStream OS=response.getOutputStream();
    OS.write(data);
    catch (Exception e)
    and the error is :
    java.lang.IllegalStateException: Response has already been committed
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.EvermindHttpServletResponse.resetBuffer(EvermindHttpServletResponse.java:1902)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:213)
    this error is stored in the log file. if i am running this code from JDeveloper I can download the files using either FireFox or Internet Explorer without any error.
    but if i am running this code using Oracle Application Server 10g Realse 2, i can not download the files using either FireFox or IE.
    so i created another solution, instead of redirecting from a datapage into the servlet, i put the following code in a data page as follows:
    public void onDownload(DataActionContext ctx)
    String DownloadFileName=getfilename();
    byte data[]=getdata();
    response.setContentType("application/octet-stream");
    response.setHeader("Content-Disposition", "attachment;filename="+DownloadFileName);
    response.setContentLength(data.length);
    OutputStream OS=response.getOutputStream();
    OS.write(data);
    OS.flash();
    this time the application works fine when deployed into Oracle Application Server if you use FireFox, but if you use IE, it causes problem, i can not save the file or view it.
    what is the problem?
    how can i fix this?
    i am certin that the second method is not correct and it should not be used.
    thanks for everyone in advance
    best regards

    Dear Sir...
    Thanks alot for your replay
    regarding the reset method. Itried it and it does not give any good.
    I discovered the following problem:
    If you are redirecting from with struts dataaction page to the servlet, you get the error
    Otherwise if you called the servlet from directly or redirected to a servlet from within a servlet, you get no problem.
    can any one help me please??
    Is it possible that the problem is in IE itself? The file is downloaded perfectly fine with firefox(but the error log still appear)?
    best regards

  • Need urgent help on file download servlet problem in Internet Explore

    I have trouble to make my download servlet work in Internet Explore. I have gone through all the previous postings and done some research on the internet, but still can't figure out the solution. <br>
    I have a jsp page called "download.jsp" which contains a URL to download a file from the server, and I wrote a servlet (called DownloadServlet) to look up the corresponding file from the database based on the URL and write the file to the HTTP output to send it back to the browser. <br>
    the URL in download.jsp is coded like <a href="/download/<%= currentDoc.doc_id %>/<%= currentDoc.name %>">on the browser, it will be sth like , the number 87 is my internal unique number for a file, and "myfile.doc" is the real document name. <br>
    in my web.xml, "/download/" is mapped to DownloadServlet <br>
    the downloadServlet.java looks like
    tem_name = ... //read DB for file name
    // set content type
    if ( tmp_name.endsWith(".doc")) {
    response.setContentType("application/msword");
    else if ( tmp_name.endsWith(".pdf")){
    response.setContentType("application/pdf");
    else if ( tmp_name.endsWith(".ppt")){
    response.setContentType("application/vnd.ms-powerpoint");
    else if ( tmp_name.endsWith(".xls")){
    response.setContentType("application/vnd.ms-excel");
    else {
    response.setContentType("application/download");
    // set HTTP header
    response.setHeader("Content-Disposition",
    "attachment; filename=\""+tmp_name+"\"");
    OutputStream os = response.getOutputStream();
    //read local file and write back to browser
    int i;
    while ((i = is.read()) != -1) {
    os.write (i);
    os.flush();
    Everything works fine in Netscape 7.0, when I click on the link, Netscape prompts me to choose "open using Word" or "save this file to disk". That's exactly the behavior I want. <br>
    However in IE 5.50, the behavior is VERY STRANGE.
    First, when I click on the URL, the popup window asks me to "open the file from its current location" or "save the file to disk". It also says "You have chosen to download a file from this location, ...(some url).. from localhost"
    (1) If I choose "save the file to disk", it will save the rendered "download.jsp" (ie, the currect page with URL I just clicked, which isn't what I want).
    (2)But if I choose "open the file from its current location", the 2nd popup window replaces the 1st, which also has the "Open ..." and "Save.." options, but it says "You have chosen to download a file from this location, MYFILE.doc from localhost". (notice it shows the correct file name now)
    (3) If I choose "Save..." on the 2nd window, IE will save the correct file which is "myfile.doc"; if I choose "Open ...", a 3rd replaces the 2nd window, and they look the same, and when I choose "Open..." on the 3rd window, IE will use Word to open it.
    any ideas?
    </a>

    Did you find a solution to this problem? I've been wrestling with the same issues for the past six months. Nothing I try seems to work. I've tried setting the contentLength(), inline vs. attachments, different write algorythms, etc. I don't get the suggestion to rename the servlet to a pdf file.

  • Apache Bridge HTTP POST problems on large file upload

    I have a problem uploading files larger than quarter a mega, the jsp
    page does a POSTto a servlet which reads the input stream and writes to
    a file.
    Configuration: Apache webserver 1.3.12 connected to the Weblogic 5.1
    application server via the bridge(mod_wl_ssl.so) from WebLogic Service
    pack 4.
    The upload goes on for about 30 secs and throws the following error.
    "Failure of WebLogic APACHE bridge:
    IO error writing POST data to 100.12.1.2:7001; sys err#: [32] sys err
    msg [Broken pipe]
    Build date/time: Jul 10 2000 12:29:18 "
    The same upload(in fact I uploaded a 8 MEG file) using the
    Netscape(NSAPI) WebLogicconnector.
    Any answers would be deeply appreciated.
    [email protected]

    It appears to be a bug.
    I suggest that you file a bug report with our support organization. Be sure
    to include a complete test case. They will also need information from
    you -- please review our external support procedures:
    http://www.beasys.com/support/index.html
    Thanks,
    Michael
    Michael Girdley
    Product Manager, WebLogic Server & Express
    BEA Systems Inc
    "George Abraham" <[email protected]> wrote in message
    news:[email protected]..
    I have a problem uploading files larger than quarter a mega, the jsp
    page does a POSTto a servlet which reads the input stream and writes to
    a file.
    Configuration: Apache webserver 1.3.12 connected to the Weblogic 5.1
    application server via the bridge(mod_wl_ssl.so) from WebLogic Service
    pack 4.
    The upload goes on for about 30 secs and throws the following error.
    "Failure of WebLogic APACHE bridge:
    IO error writing POST data to 100.12.1.2:7001; sys err#: [32] sys err
    msg [Broken pipe]
    Build date/time: Jul 10 2000 12:29:18 "
    The same upload(in fact I uploaded a 8 MEG file) using the
    Netscape(NSAPI) WebLogicconnector.
    Any answers would be deeply appreciated.
    [email protected]

Maybe you are looking for