Redirection in JSP

Dear All,
I have the following requirement and I am not able to find a solution.
I have four jsp files called one.jsp, two.jsp, three.jsp, four.jsp.
On clicking the submit button in one.jsp, the request goes to two.jsp. two.jsp will do some processing and will redirect to three.jsp after passing some condition. If the condition fails, the request ends there. Now my requirement is to display the four.jsp if the condition fails, after waiting for about 30 seconds. 30 seconds is because it is assumed that it will take a max of 30 seconds to check the candition. The catch here is that two.jsp is not my control and its somewhere in a different web server.
I will be really thankful if anybody can give some idea. Is this really possible ????

Ramya,
use URL and URLConnection to connect to the two.jsp which is in some
other server, get the response and on the basis of the response do
the further operations.
Regards
Goodieguy

Similar Messages

  • How to redirect a JSP page after the session is killed

    Hello!
    I am quite new to JSP. I have a question about how to redirect a jsp page after the session is killed. Could anyone help?
    thanks a lot in advance!

    You can't, directly. There's no connection betweenthe server and browser.
    even after invalidating the session. we can do it
    directly using the statement
    response.sendRedirect("....");
    or we can use the meta refresh tag.if session is invalidated and if we try to do response.sendRedirect(".. ") it throws IllegalStateException

  • Redirect from JSP to JSP

    Hi,
    I want to know how i can redirect a page from a jsp page. It's a simple question but i'm beginnner...
    Best regards...

    This works me perfectly:
    your webapp can be also structured to directories.
    for normal visible link:
    <a href="<%= response.encodeURL(../index.jsp")%">">back to index</a>
    for automatic redirection (like jsp:forward):
    response.sendRedirect(response.encodeRedirectURL("../index.jsp"));
    NOTE:
    URLs are wrapped by response.encode*URL() methods to allow URL rewriting in case when cookies are disabled by client.
    Mako</a>

  • Redirect from jsp bean to jsp or html page

    I am facing a problem in redirecting to a jsp page from jsp bean
    How do i redirect from jsp bean to any other page like jsp or html.
    [email protected]

    Hi
    The solution you suggested we tried it long before only but it is not feasible for us as we have to implement it in all web pages which are in thousands.
    My need is like this.
    We have given specific time to each of our registered user , as user logs to our portal we calculate session time in bean and as he logs out is new time gets updated. (its like dial up connection)
    Now what happens consider user has left only 10 minutes balance, I can calculate and keep track for his time in bean.Now as the time becomes zero I want to redirect him to home page.
    As u said i can get return value zero for bean and can do it ,but our webpages are near about thousands.

  • Redirection to JSP page from Applet not working...

    Hello,
    I have some JSP pages that obtain information and set session variables. Once they have gotten the information, they call an applet to perform some processing, then the applet redirects back to the calling page. My problem is that when the applet redirects using
    getAppletContext().showDocument(reportJspUrl, "_self");
    it seems to be unable to see the session variables that I set in the beginning - consequently I am getting a faulty session timeout error. Has anyone seen this problem? I don't understand why it is happening. It seems that when the applet causes the page to be shown, the page should be able to see the session since it is in the same browser, even in the same frame of the browser.
    Thank you for your help in advance.
    Ali

    Have you tried getting the session in the jsp with req.getSession(false) and confirming that the session returned is not null.

  • How to redirect a jsp page?

    Hi
    I have two jsp pages called submit.jsp and save.jsp.In the submit.jsp page
    I wrote the following code
    <form name= Submit action=save.jsp>
    <input type=Submit name=save value=save>
    whn i submit save .jsp page is opend and will dispaly a message saved the data.Now wht i want is after the save.jsp page is opened the page should be automatically redirected in 3 seconds to submit.jsp that is the first page.How can i dothis.Pls give me some code.
    Thanks

    Something like...
    <META HTTP-EQUIV="Refresh" CONTENT="3; URL=your.jsp">
    in your <head> tag where 3 is the number of seconds to wait.

  • WebCenter RIDC DataControl always redirects any JSP page to login page

    Hi
    I have created a Data Control which connects to the UCM data repository and created a plain JSP page to return the results. I have used RIDC Connection settings and authentication details are tested and they look fine to me.
    RIDC Socket Type: socket
    Server Host Name: localhost
    Content Server Listener Port: 4444
    Authentication: Identity Propagation
    Username/Password: weblogic/weblogic
    But when ever I ran the test JSP page, it always redirects the page to login page. For example: http://127.0.0.1:7101/RIDCDocumentManager-Portal-context-root/faces/oracle/webcenter/portalapp/pages/login.jsp
    Any suggestions?
    Thanks
    Khad

    Thanks for the details Yannick. The home.jspx works as expected. Thanks for that.
    I have got one more question on passing username through RIDC api.
    Via RIDC, how can I pass the UserName to the IdcContext object dynamically [IdcContext userContext = new IdcContext("weblogic");]. I mean how to retrieve the logged in user name for the person requesting the page instead of hardcoding the username. Below is the code fragment:
    // create the manager
    IdcClientManager manager = new IdcClientManager();
    // build a client that will communicate using the intradoc protocol
    IdcClient idcClient = manager.createClient("idc://localhost:4444");
    // get the config object and set properties
    idcClient.getConfig().setSocketTimeout(30000); // 30 seconds
    idcClient.getConfig().setConnectionSize(20); // 20 connections
    //create a simple identity with no password (for idc:// urls)
    IdcContext userContext = new IdcContext("weblogic");
    // create an identity with a password
    //IdcContext userPasswordContext = new IdcContext("weblogic", "idc");
    // get the binder
    DataBinder binder = idcClient.createBinder();
    // populate the binder with the parameters
    binder.putLocal("IdcService", "GET_SEARCH_RESULTS");
    //binder.putLocal("QueryText", parameter);
    parameter = getInputParameter();
    binder.putLocal("QueryText", "<qsch>" + parameter + "</qsch>");
    binder.putLocal("ResultCount", "20");
    // execute the request
    ServiceResponse response = idcClient.sendRequest(userContext, binder);
    // get the binder
    DataBinder serverBinder = response.getResponseAsBinder();
    DataResultSet resultSet = serverBinder.getResultSet("SearchResults");
    // loop over the results
    for (DataObject dataObject : resultSet.getRows())
    dataObject.get("dDocTitle");
    dataObject.get("dDocAuthor");
    dataObject.get("dInDate");
    System.out.println("Title is: " + dataObject.get("dDocTitle"));
    System.out.println("Author is: " + dataObject.get("dDocAuthor"));
    System.out.println("Author is: " + dataObject.get("dInDate"));
    }

  • Help with 301 redirect code - jsp in url

    I'm trying to set a 301 redirect in my jsp code (this is tomcat btw) using this:
    <%
    response.setContentType("text/html");
    response.setDateHeader("Expires", 0);
    response.setHeader("Location", "http://www.mysite.com/record/pleasehelpme /helpmeheretoo");
    response.setStatus(301);
    %>
    the pleasehelpme and helpmeheretoo need to use variable values i get from mysql which i would normally express in the application like
    <%=(((Recordset1_data = Recordset1.getObject("avariable"))==null || Recordset1.wasNull())?"":Recordset1_data)%>
    so what do i need to stick in those parts of the path in the url?
    it works great redirecting to a flat url but I need those variable (well, that's the point of this anyway).
    sticking the <%= recordset stuff %> is breaking since it's like a tag in a tag (i guess) - have tried variations on sticking println around (String)Recordset1.getObject("avariable") like
    "http://www.mysite.com/record/(out.println(String)Recordset1.getObject("avariable"))"
    and variations with curly braces and semicolons and everything but i keep getting
    Syntax error on token "avalue", invalid AssignmentOperator
    errors. (i'm obviously tring to figure out just one variable before i stick both in the path while i get this figured out).
    can someone hit me with a clue stick?

    And then finally I found a .php option (which I saved in my root directory)
    <?php
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: http://www.downtoearthlandscaping.ca/#!/page_Home");
    ?>
    I
    This works, does your server support php?
    You don't need:
    header("HTTP/1.1 301 Moved Permanently");
    Just this:
    <?php
    header("Location: http://www.downtoearthlandscaping.ca/#!/page_Home");
    ?>
    Saved as index.php
    The server will find index.php and the first page should be displayed.

  • Losing beans after redirecting in jsp

    hi , everybody
    I am new in web programming.
    this is my jsp :
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    </head>
    <body>
    <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
    <bean:write name="mess" property="text"/><br>
    your username: <bean:write name="user" property="name"/><br>
    your password: <bean:write name="user" property="password"/><br>
    To add the book to Database click <a href="/pages/BookAdding.jsp">here</a><br>
    To rent the book click <a href="pages/RentBook.jsp">here</a>
    </body>
    </html>
    <as you can see here i have 2 javabeans 1-mess 2-user
    and 2 possibilities for redirection (<a href....>)
    after redirection my beans are null....
    somebody can help me please???
    thanks

    First of all, the taglib declaration should be on the top of you jsp.
    <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    </head>
    <body>
    <bean:write name="mess" property="text"/><br>
    your username: <bean:write name="user" property="name"/><br>
    your password: <bean:write name="user" property="password"/><br>
    To add the book to Database click <a href="/pages/BookAdding.jsp">here</a><br>
    To rent the book click <a href="pages/RentBook.jsp">here</a>
    </body>
    </html>The beans are lost because they have either a page or a request scope.
    To avoid this, put them in the session scope instead.
    A very good tutorial here http://courses.coreservlets.com/Course-Materials/csajsp2.html
    See The JSP 2.0 Expression Language: Simplifying MVC and Access to Java Code part.
    Hope it helps

  • Redirecting in JSP

    Hi all,
    I have a file named session.jsp which i use to check the session value. If a session value is null, i want to redirect the user to login page. The Code for session.jsp is as:
    <%
    if((session.getValue("name") == null))
    { %>
    <jsp:forward page ="index.jsp" />
    <% } %>
    Now I include this file in a new jsp file named xyz.jsp. Now i access xyz.jsp without logging in. So the session contains null in name variable (I have printed this value too and it contains null). But I am not redirected to index.jsp. I also tried using response.sendRedirect("index.jsp") but i m not redirected.
    I am using Tomcat server
    Secondly, I have a file named header.jsp Now whenever i change this file, i have to once again save all the files which use header.jsp ( i use include directive). Is there some method of avoiding this.
    Thanks
    Gagan Arora

    Hi,
    Instead of
    if((session.getValue("name") == null))
    try
    if((session.getAttribute("name") == null))
    nurettinThanks for ur support but even this doesnt works. I now recieve a Error message :500
    IOExecption: Attemp to clear a buffer thats already been flushed

  • Redirecting with jsp

    hi.
    i need to check for the session on one of the page which located in the frame and if there is no session to redirect user to some page, which must be on the _top level of frameset, similar thing is in regular hyperlink people use:
    target="_top" is it possible to do it with jsp response.sendRedirect? (response.sendRedirect("/index.jsp"); )
    thanks in advance

    frame is a HTML idea, so HTTP(and HTTP ridirection) has no idea about it. One solution is to use javascript.
    You can also use jsp in the page that defines teh framesets. It can check for the session, and if necessary loads the new page rather than using the framset.
    You may also consider not using frames as much as possible. Rather, you can use jsp templates which uses table to structure different parts of the page and use include(staic/dyn as needed) to construct the page.

  • Redirect using jsp

    how can i redirect users to another URL with jsp code

    response.sendRedirect("your URL");
    . . . or . . .
    response.getRequestDispatcher("url relative to your servlet context").forward(request, response);
    . . . or . . .
    <jsp:forward page="url relative to your servlet context"/>

  • Redirect to jsp

    The code in Action
         boolean war= false;
            if ( CD.after(AD) ){
              war= true;
              msgAgreement="val";
            req.setAttribute("war",""+war);Code in Struts Config file
    <action path="/tell/Act"
                type="com.user.action.SampleUser"
                name="uform" scope="session" validate="false">
          <forward name="success"           path="/tell/scent.do" />
          <forward name="failure"             path="/tell/leave.jsp" />
          <forward name="error"             path="/tell/login.jsp" />
          <forward name="val"             path="/tell/login.jsp" />
      </action>code in JSP
              <c:when test="${war == 'true'}">
                   alert("This is the Warning ");
              </c:when>Here this code is working fine but afterthe alert message is been displayed i want to go to the "scent.do" page am not able to do it can anyone please help me in this?
    Edited by: ferrari on Mar 18, 2008 12:36 AM

    hi
    i tried doin it but its throwin an HTTP exception.
    I had one more doubt the alert that i am displaying doesnt appear the first time when i click the button it works only in case when the user clicks teh button the second time. Can you give me nay suggestion in what case this happens.
    Thanks

  • Change protocol when redirecting a request for a servlet to jsp

    Hello,
    In my servlet, There is a line of code:
    getServletConfig().getServletContext().getRequestDispatcher("/page.jsp").forward(request,response);
    My question is: I'd like to change the current protocol (like http) to new protocol (like https) or versa vista before my servlet executes the above line.
    Is this possible to implement that? If so, how can I do it?
    If not implement, Is there any ways to convert back or forward between http and https protocols in java, servlet or jsp?
    I did try to use window.location.href="protocol://myserver/..." in javascript to redirect the jsp page to the right protocol, but the session for the browser was lost, and the jsp page ran into infinite loop.
    Thanks in advance for any helps.
    Mike.

    if (!request.isSecure()) response.sendRedirect("https://me.com/page.jsp");
    (or visa versa)

  • How to redirect the to the file outside the context from jsp

    Hello Everybody,
    I am trying to redirect using jsp to the file available physically in the server machine out side the application.
    How can I do it..
    Thanks
    Saikrishna

    Write a servlet which takes the file ID as parameter, reads the file from the disk and writes it to the outputstream of the response. Finally redirect to that servlet with the file ID as parameter.
    You can find here an example of such a FileServlet: [http://balusc.blogspot.com/2007/07/fileservlet.html].

Maybe you are looking for

  • What is setting required In Middle ware?

    What is setting required In Middle ware?

  • TS3048 Genuine Apple Bluetooth Wireless keyboard - Model A1016

    I was given an iMac M6498, wireless keyboard Model A1016 and wireless mouse. The first time I plugged the iMac, the keyboard worked perfectly and the sencond time, it stopped working and it is not recognised. I have changed the batteries and still it

  • (9I) DYNAMIC SGA : SGA_MAX_SIZE, DB_CACHE_SIZE, DB_KEEP_CACHE_SIZE

    제품 : ORACLE SERVER 작성날짜 : 2005-01-05 (9I) DYNAMIC SGA : SGA_MAX_SIZE, DB_CACHE_SIZE, DB_KEEP_CACHE_SIZE ================================================================== PURPOSE Oracle 9i의 새 기능인 동적으로 SGA 파라미터들을 변경하는 방법에 대하여 알아보기로 한다. Explanation Ora

  • Quick data transformation query

    Hi guys, newish to Oracle from an and am trying to do the following... so many thanks for any help! if mytable.col1 is not blank, then copy mytable.col1 to mytable.col2 BUT, it needs reformatting during the copy. Both columns are varchar2 col1 being

  • Weird and Incorrect Date Added Info in iTunes

    iTunes is showing me bizarre dates in the "Date Added" column.  Examples are "6/29/14180", "1/5/145", and "12/29/12364".  I should note that I'm running the latest version of iTunes and the latest version of Mavericks, but the iTunes library that I'm