Multiple Redirects through Servlet

I am very new to jsp and java servlets. I am trying to put a processing page that appears while some work is done and then the servlet redirects to a output page that displays reports. I am not sure how to do this.
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    //send initial redirect to a processing page
    //do some work
    RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/reportOutput.jsp");
    dispatcher.forward(request, response);
}Any ideas?

Use Javascript to display a hidden <div> element with some animated gif when the submit button is pressed.
If you really want an intermediate page, then you need to fire a new thread to do the progress and use the meta refresh header or ajaxical techniques to check the current progress.

Similar Messages

  • Problem in opening .ics and .vcs file types through servlet in IE browser.

    I'm having problem in downloading an .ics and .vcs file through servlet in I.E browser. It is happening fine in Mozilla firefox(they both are getting opened in OutLook), but in IE it says as undefined file type.
    I'm using Content Type as : 'text/Calendar' and then setting header as :
    response().setContentType("text/Calendar");
    response().setContentLength(file.length());
    response().setHeader("Content-Disposition", "attachment;
    filename="+filepath);
    and after that i'm writing it to OutPut stream.
    Plz Help.

    Hi,
    On page load check whether the session values are there. If not redirect the user to the login page.
    Hope this helps,
    Regards,
    Sammani

  • Providing redirects in Servlet filter

    Hi,
    I need to provide serverside redirects in Servlet filter.O tried the below code, But unable to do it.
    Is it possible to do such a thing.
    public void doFilter(ServletRequest req, ServletResponse res,
                   FilterChain chain) throws IOException, ServletException {
              logger.info("Start of RedirectFilter ");
              HttpServletRequest request = (HttpServletRequest) req;
              HttpServletResponse response = (HttpServletResponse) res;
              String requestURI=request.getRequestURI();
              String domainURL=request.getServerName().toLowerCase();
              logger.info("domainName--"+domainName);
              String keywordToBeAppended=domainURL.replaceAll(domainName,"");
              logger.info("url--"+request.getRequestURI());
              logger.info("servername--"+request.getServerName());
              logger.info("keywordToBeAppended-"+keywordToBeAppended);
              String finalURL= request.getScheme()+"://"+domainURL+"/"+keywordToBeAppended+requestURI;
              logger.info("finalURL--"+finalURL);
              RequestDispatcher rd = request.getRequestDispatcher(finalURL);
              rd.forward(request, response);
              logger.info("End of RedirectFilter ");
              chain.doFilter(request, response);
         }

    There is technically a huge difference between "redirect" and "forward". You're doing here forwards. And because you continue the filter chain, you run into problems. You should do either a forward OR continuing the current request unchanged (through the filter chain) OR send a redirect. You cannot do one or more simultaneously.

  • How to open multiple forms through differnt responsiblity

    I have a 11.5.10.2 system on Linux red hat.
    Business pepole want to open multiple forms through different responsiblities from multiple web brower sessions.
    However when I opened 2 IE brower sessions, log into responsiblity and open one oracle form in one IE session and log into another responsiblity through second IE session. The first opened form disappear and replaced by the second oracle form opened from another IE session. That means only one Oracle form can be open at the same time for this case.
    The current walkaround solution is to open 2 browser sessions using 2 different browsers ( one is IE another is Firefox) to fix this issue. Apparently this is not a good solution.
    Can you please give me some suggestion to fix this issue?

    Thank you very much for the information.
    The note mention:
    The new forms launcher does not support opening multiple forms applets for the same database across different responsibilities. Opening a form in another responsibility will cause any forms currently open to close. This behaviour is standard.
    However it is possible to enable users to open multiple forms sessions for the same database for the same responsibility when using MS Internet Explorer as the client browser. This is made possible with Patch 3293241. This patch is included in Oracle Applications release 11.5.10 as standard.
    My current system is 11.5.10.2. I verified that patch 3293241 has been applied. I have no problem to open mutiple forms with in SINGLE web brower session, within same responsibility. I am aware that you can not open multiple forms through SINGLE web brower session through multiple responsiblity. What I tried to do is to open mutiple forms through multiple web browers sessions. Open one brower session, log into system and open a form, then open another web brower session, log into the sytem and open a form through different responsiblity. The system does not allow me to open multiple forms through multiple web brower sessions. Only the latest form can be displayed. Is this standard design for 11.5.10?
    Can Form Servlet architecture solve this limitation?
    Actually afterI changed some form funcation paramter in Oracle Application Developer responsiblity, I can open 2 form session from 2 different responsiblities through 2 web brower sessions. I can open one form session as Application Developer and another form session through another responsiblity. Then I can switch to other responsiblity through Application Developer responsiblity to open forms.
    Is there any other way I can open multiple form sessions to the same database through multiple web brower sessions?
    Thanks a lot for your help
    Edited by: wcxtao on Nov 3, 2008 9:47 AM
    Edited by: wcxtao on Nov 3, 2008 9:57 AM
    Edited by: wcxtao on Nov 3, 2008 10:08 AM

  • Not able to retrieve data from database through servlet

    Hi friends,
    I am trying to open a excel sheet through servlet. In this servlet i am retriving data from mssql database.I am not getting any error but no data is retrived
    i m also pasting the code here
    // Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
    // Jad home page: http://www.kpdus.com/jad.html
    // Decompiler options: packimports(3)
    // Source File Name:   EmployeeData.java
    import java.io.*;
    import java.sql.*;
    import javax.sql.*;
    import javax.servlet.ServletException;
    import javax.servlet.http.*;
    public class EmployeeData extends HttpServlet
        public EmployeeData()
        public void service(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse)
            throws ServletException, IOException
            httpservletresponse.setContentType("text/html");
            httpservletresponse.setHeader("Content-Type", "application/excel");
            httpservletresponse.setHeader("Content-Disposition", "filename=reports.xls");
            PrintWriter printwriter = httpservletresponse.getWriter();
            try
                javax.servlet.http.HttpSession httpsession = httpservletrequest.getSession(true);
                int i = 0;
             /*   Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
                Connection connection = DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:3413;DatabaseName=newreportsodbc", "reportuser", "cisco");*/
                String url="jdbc:odbc:newreportsodbc";
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
                Connection connection = DriverManager.getConnection("jdbc:odbc:newreportsodbc","reportuser","cisco");
                Statement statement = connection.createStatement();
                printwriter.println("<b><center><u> Search Results </u></center></b>");
                printwriter.print("<table><tr><th color=brown background-color=#fff000>  No.  </th>");
                printwriter.print("<th> DateTime      </th></tr></table>");
           ResultSet resultset = statement.executeQuery("SELECT * FROM t_Call_Type_Half_Hour");
                boolean flag;
                for(flag = false; resultset.next(); flag = true)
                    i++;
                    SerialNo = resultset.getString(2);
                    printwriter.print((new StringBuilder()).append("<table><tr><td> ").append(i).append("</td>").toString());
                    printwriter.print((new StringBuilder()).append("<td> ").append(SerialNo).append("</td></tr></table>").toString());
                if(!flag)
                    printwriter.println("<h1> No records selected </h1>");
            catch(Exception exception)
                System.out.println((new StringBuilder()).append("SQLException: ").append(exception).toString());
        static String empid1;
        static String empid;
        static String SerialNo;
        static String designation;
    }thanks in advance. i just feel there is something to be done with connection string.

    post the table format in SQL

  • Store Image through Servlet

    I want to store a JPG image into database column through Servlet
    and dispaly it on a JSP page through Beans
    how can i ?

    Any requests made to a JSP are of a certain content. Generally you make a request to a JSP page it sends back a "text/html" document. There is noi binary data as such just text.
    Images on a page are displayed because the "src" attribute of the image tag points to a server location. This in turn returns content of type "image/*".
    A servlet can retrieve/generate your images for you for example you could point to a servlet:
    <img src="/system/imageServlet">
    I guess a JSP can do the same (I've never tried it) just remember to set the response.contentType to "image/gif"/"image/jpg".....
    Cheers,
    Anthony

  • Apple Mail stopped today; server suddenly redirects through Yahoo

    At about noon today my AppleMail stopped loading. Somehow the incoming server address got changed to redirect through Yahoo (I've never had a Yahoo acct), and the box is greyed-out so I can't change it. Frustrated. This has happened with three email addresses I use. Until a couple of hours ago the outgoing server was fine but now that won't even work. The computer has slowed down and is nearly unresponsive.

    Thanks much.
    I get a dialogue box that says Internet Account Preferences can't connect to the account. It asks for the password. When I type it in, I get a message Unable to Verify Account Name or Password. This happened on all three email addresses.  There was no "Advanced" option to select. (I'm able to access all of my mail through Verizon's website; it's just Apple Mail that is the problem. It is very slow in responding in any direction: click on a folder and it takes many seconds to open; try to open a new blank message, it takes several seconds and then the curser sticks or doesn't work). All other applications are working okay but considerably slower than earlier today.
    I made an appointment at the Genius Bar for tomorrow. Maybe this has something to do with Yosemite, but I downloaded that several days ago and it's been working well.

  • Objects through servlet

    How to pass the object through servlet?

    I can venture a guess that the OP wants to 'send' an object as a request parameter or a form field.
    You'd have to turn the object into some data representation that can later on be translated back into the object; serialization comes to mind. It might be easier to just send the properties of the object as seperate request/form fields though!

  • Insert Arabic through Servlet

    Hi,
    I am able to read Arabic characters through servlets and able to display in a browser .
    But when I try to insert Arabic characters to Oracle Database through servlets ,
    it is saved as ??????? or inverted question marks
    Kindly help me resolve this issue.
    Thanks and Regards
    Jailani

    and since email replies won't work with the "<>" chars in them:
    in application.cfm
    <cfset setEncoding("url","UTF-8")>
    <cfset setEncoding("form","UTF-8")>
    <cfcontent type="text/html; charset=UTF-8">
    at the top of your cf pages add:
    <cfprocessingdirective pageEncoding="UTF-8">

  • Oracle NoSQL through Servlet.

    Hello Everyone,
    I am trying to execute the nosql operations on server through servlet. I want to make an client server application but dont know why the CONNECTION TO KVSTORE IS NOT ESTABLISHED WHILE EXECUTING ON SERVLET.
    So is there any separate configuration needed to do so?
    Thanks In Advance.

    Could you be more explicit please?  What is the exact error you are seeing?
    Please explain in detail what is the issue you're facing.
    If you want to access an Oracle NoSQL Database KVStore through a servlet the best way would be to use a ServletContextListener in your web app that gets the KVStore handle and places it in application/context scope as an attribute (so that all servlets and JSPs would have access to it) and also closes the handle when the web app gets shut down.  You could even supply the store name, store host name and store host port (the helper host port -- hostName:hostPort) through the web.xml web app config file.
    Here is a simple example of such a ServletContextListener:
    import javax.servlet.ServletContext;
    import javax.servlet.ServletContextEvent;
    import javax.servlet.ServletContextListener;
    import javax.servlet.annotation.WebListener;
    import oracle.kv.KVStore;
    import oracle.kv.KVStoreConfig;
    import oracle.kv.KVStoreFactory;
    * KVStoreClientContextListener implements ServletContextListener, hence it will be
    * invoked when the application context is initialized and destroyed.
    * @author Andrei Costache
    @WebListener
    public class KVStoreClientContextListener implements ServletContextListener {
        @Override
        public void contextInitialized(ServletContextEvent sce) {
            ServletContext sc = sce.getServletContext();
            KVStore ondbstore = null;
            try {
                // Try to get the store name, store host name and store host port from web.xml,  as context attributes.
                // If they are not available, then default to the values specific to a default KVLite instance.
                String storeName = (String) sc.getAttribute("storeName");
                String hostName = (String) sc.getAttribute("hostName");
                String hostPort = (String) sc.getAttribute("hostPort");
                if (storeName == null) {
                    storeName = "kvstore";
                if (hostName == null) {
                    hostName = "localhost";
                if (hostPort == null) {
                    hostPort = "5000";
                // Get the KVStore and place it as an atribute in application/context scope.
                ondbstore = KVStoreFactory.getStore(new KVStoreConfig(storeName, hostName + ":" + hostPort));
                sc.setAttribute("ondbstore", ondbstore);
            } catch (Exception e) {
                sc.log("Could not get a KVStore instance");
        @Override
        public void contextDestroyed(ServletContextEvent sce) {
            KVStore ondbstore = null;
            ServletContext sc = sce.getServletContext();
            try {
                ondbstore = (KVStore) sc.getAttribute("ondbstore");
                if(ondbstore != null) {
                    ondbstore.close();
            } catch (Exception e) {
                sc.log("Could not successfully close the KVStore handles");
    In your servlets or JSPs you will simply retrieve the KVStore handle from the servlet context, where it is found as a context scope attribute:
    KVStore ondbstore = (KVStore) getServletContext().getAttribute("ondbstore");
    and do whatever operations you want using the KVStore handle.
    You will need the NoSQL Database kvclient.jar -- either your web container / application server can load it, or you could copy it under the WEB-INF/lib directory so that it gets loaded when your web app gets deployed and started.  (kvclient.jar is found under kv-M.N.P/lib).
    Regards,
    Andrei

  • How to create plant wise STO from multiple requisition through Me59N

    How to create plant wise STO from multiple requisition through Me59N

    Due to the different supply plants the system does not know which one
    to use and therefore throws the error message.
    The only workaround would be to create the PO's seperatly per PR item.
    Hoep this helps you

  • Select from multiple tables through dblink

    I am seeking help. Can I select multiple tables through a dblink from a remote database? I tried, it seems it always return ORA-00933 error. code like this:
    select A.ID, B.CODE, C.TYPE_DESC
    from TABLE_ONE A@db_link , TABLE_TWO B@db_link, TABLE_THREE C@db_link;
    where A.ID = B.ID
    and B.CODE = C.CODE
    Thanks in advance.

    Just as an FYI, from a performance standpoint, it is frequently the case (though certainly not guaranteed) that you'll get better performance creating a view on the remote database that does the join of all three tables and to use that view in your query, particularly if you're also joining in local tables. Optimizing SQL statements across database links tends to be particularly hard, a view often helps force Oracle to join the remote tables on the remote database which is generally what you'd want. Of course, this is not a guarantee, and you can always get explicit with hints to force joins to happen on one or the other system, but this is frequently the easiest starting point.
    Justin

  • Running an executable file through servlet

    Hello People,
    I tried searching about this on the Forums, but could not find the right solution.
    Please donot get annoyed if you find this to be a repeted topic, which I am sure is not.
    I want to run a .sh file in Unix environment through servlet.
    Actually i want to do this inorder to schedule a report servet to run a report and generate the output in a particular format on a click of a button.
    I tried using Runtime.getRuntime().exec method, (which I know through forum is unreliable)
    Can anyone suggest me a method through I can achieve this?
    Any suggestion is appreciated.
    Regards,
    Rohan Kamat

    Hi MOD,
    Thanks for the quick reply.
    Heres what I am doing to schedule.
    1) The client selects the necessary parameters from the front end and then saves it in a table.
    2) This he will be doing for as many reports as he wants, on an average there will be 200 reports daily.
    3) Once he has selected all the parameters for all the reports, he will go to the next screen and fire a script to run the reports at a time.
    4) This script will be fired only once. And once it is fired it will generate a PDF files of the reports.
    5) On the front end the screen will be refreshed showing the users the status of the reports that he has scheduled to be run
    I am using Servlets 2.0 version, and jdk.12
    Regards,
    Rohan Kamat

  • Redirecting the servlet output to jsp

    Hi i need to redirect my servlet out put to jsp
    in result set's every row i have 9 columns
    this result set how can i redirct to jsp
    plz can any one let me know with an example
    thanks a lot in advance

    inamdar wrote:
    Hi i have never used DTO's and DAO classes
    plz colud u let me know without using that..Huh? It is never too late to start with it. Just create two simple classes. A DTO class is basically a simple javabean with private (encapsulated) properties and a public getter and setter for each property. A DAO class is basically a class which contains purely JDBC code.
    Sample DTO:public class MyData {
        private Long id;
        private String name;
        private Integer value;
        public Long getId() { return id; }
        public String getName() { return name; }
        public Integer getValue() { return value; }
        public void setId(Long id) { this.id = id; }
        public void setName(String name) { this.name = name; }
        public void setValue(Integer value) { this.value = value; }
    }Sample DAO:public class MyDataDAO {
        public List<MyData> listAll() {
            String listAllQuery = "SELECT id, name, value FROM data";
            List<MyData> myDataList = new ArrayList<MyData>();
            Connection connection = null;
            Statement statement = null;
            ResultSet resultSet = null;
            try {
                connection = getConnectionSomehow(); // DriverManager or Connection Pool, your choice.
                statement = connection.createStatement();
                resultSet = statement.executeQuery(listAllQuery);
                while(resultSet.next()) {
                    MyData myData = new MyData();
                    myData.setId(new Long(resultSet.getLong("id")));
                    myData.setName(resultSet.getString("name"));
                    myData.setValue(new Integer(resultSet.getInt("value")));
                    myDataList.add(myData);
            } catch (SQLException e) {
                // Handle it. Print it, throw it, log it, mail it, your choice.
                e.printStackTrace();
            } finally {
                // You can write an utility class/method for those lines as well.
                if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { e.printStackTrace(); } }
                if (statement != null) { try { statement.close(); } catch (SQLException e) { e.printStackTrace(); } }
                if (connection != null) { try { connection.close(); } catch (SQLException e) { e.printStackTrace(); } }
            return myDataList;
    }Sample Servlet code:List<MyData> myDataList = new MyDataDAO().listAll();
    request.setAttribute("myDataList", myDataList);
    request.getRequestDispatcher("someJspFile.jsp").forward(request, response);Sample JSTL code in someJspFile.jsp:<table>
        <c:forEach items="${myDataList}" var="myData">
            <tr>
                <td>${myData.id}</td>
                <td>${myData.name}</td>
                <td>${myData.value}</td>
            </tr>
        </c:forEach>
    </table>Simple and clean, isn't it?

  • Installing multiple applications through one application (or package)

    I am trying to make an application (or package) that will install multiple programs through the one application.  Right now the only way I can see to do this, is to force an application to install another one as a requirement.  The easiest example
    I can give is iTunes.  We customize the iTunes install to lock down features and not install every application that isn't needed in our environment.  So technically iTunes actually installs 5 different programs.  I need to be able to select
    iTunes during an OSD deployment using the MDT UDI Wizard, and it will install iTunes and anything needed for it to work correctly.  
    I am just using iTunes as an easy example to explain.  We have other programs that work in a similar way, or require other applications to be install.  My main reason for this request is we have standard engineering applications, but I don't want
    them installed on all computers, I want just one option that will in turn install all the standard applications.  
    I am guessing what I will have to do, is make one install that requires the previous application and installs it, and do that for each application, but this doesn't seam like a good solution as it means I will have to have a separate application only for
    this OSD problem.
    Is there an easier/correct way of doing this, mainly for OSD?
    Thank you,

    Dependencies only forces the box to be checked, it doesn't install it in the correct order.  We are having another problem in that area.  We have an Office add-on that in SC requires a version of office to be installed.  We can't set the dependency
    for that add-on since we have multiple versions of office, but even if a version of office is selected, it doesn't try to install it before it tries to install the add-on.  So the add-on install ends up failing since office isn't installed when it tries
    to install, even though it installs afterwards.  
    This is why I am not considering using dependencies since I can't get it to install in the correct order.  If there is a way to enforce the when something gets installed, then yes, this would work for me.

Maybe you are looking for

  • New Airport Extreme Set Up Issues

    I purchased a new Airport Extreme 802.11n Wi-Fi Wireless Base Station today. I followed the instruction and set it up. My problem is I can not get the networking capability across my family members machines. My set up is that I have Two Compaq PCs ru

  • How do i copy files from my macbook pro to a usb drive

    how do i copy files from my macbook pro to a usb drive

  • How to operate multiple querys using DB Adapter and 'Execute Custom SQL'

    I have a requirment that I need to create database adapter in your BPEL process with 'Execute Custom SQL' to operate multiple query in DB in one atomic here are the details: inbound request: <ns1:Query_bpelProcessRequest> <ns1:input> <ns1:ItemDetail>

  • Dependencies of meta data in XML forms builder

    Hello, I created property metadata with dependencies between them. In my example the base property is "Type" (e.g. Programming, Customizing, Formulars). The shell property is "Theme", is set to maintainable and got the additional metadata: "dependOn=

  • Secure External LDAP with local user provisioning in a org.

    To all: I'm working with 05Q1 or as some say v3. I was able to successfully set up user authentication with external ldap and dynamic creation of users with in local org and ldap and map over attributes for storage into local ldap. Now I need to try