How to redirect a page

Hi,
I try to create a page the is redirected to another page, but don't work.
What can I do? When the page is redirected the top level navigation must be refreshed?
I write this code:
IPageContext myContext = PageContextFactory.createPageContext(request, response);
if (myContext == null) {
System.out.println("htmlb service did not start up as expected.");
String URL = path to page in PCD;
Document mydocu = myContext.getDocument();
mydocu = myContext.createDocument("Pagina da redirigere");
mydocu.setHeadRawText("<meta http-equiv=\"refresh\" content=\"1; url=" + URL +  "/>");
Anybody can help me?
Thanks in advance.
regards,
Stefano

Hi,
I don't know if this solves your problem, but this is an iView that redirects to www.google.es:
<pre>
import java.io.IOException;
import com.sapportals.portal.prt.component.*;
import javax.servlet.http.HttpServletResponse;
public class Redirect extends AbstractPortalComponent
    public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
          HttpServletResponse resp = request.getServletResponse(true);
          try {
               resp.sendRedirect("http://www.google.es/");
          } catch (IOException e) {
               e.printStackTrace();
</pre>
Hope it helps,
jc!

Similar Messages

  • How to redirect a page to a new window instead of the current one

    Can someone please tell me how to redirect a page to new window.
    I mean I am running a JSP with a button and on clicking it i am opening a new window (thru javascript offcourse),
    Now response.sendirect("New.jsp") should be opened in that new window opened.
    I tried it but the New.jsp page is opened in the current page (Even though new window is opened ! ).
    Please help.

    Hi,
    U can use the following code to Pop up in new window
    Jsp1.jsp
    <%
    if(action != "")
    response .sendRedirect("Jsp2.jsp");
    else
    %>
    <html><head><title>JSP 1</title>
    <script language="JavaScript">
    function View()
    window.open("Jsp1.jsp?action=view","View","");
    </script>
    </head><body>
    <form name="frm" method="post">
    <input type="button" value="View" onclick="View()">
    </form>
    </body>
    </html>
    <%

  • How to redirect the page to home after alert message in APEX

    Hi All,
    I have 4 tab and home page APEX report in that home page I have organization to select as parameter for all the page which is mandatory column so without select the organization in home page I can move to other 4 page but some time users directly pressing the tab for this I have create the ORG_ALERT in each 4 page which this we are able to see the pop-up message when we directly hitting on tab but after select the OK to alert message the page is run for long time and it show all the organization data which I don't want so how can I modify the alert so that after pop-up message it will go to home page.
    Declare Output VARCHAR2 (20);
    begin 
    Output := 1;
    Output := NVL( :AI_ORGANIZATION_ID , 0);
    IF Output  = '0'  THEN
       APEX_UTIL.SET_SESSION_STATE('AI_ORGANIZATION_CODE','');
       HTP.p ('<script type="text/javascript">');
       HTP.p ('alert("No Organization selected.\n Please select an Organization");' );
       HTP.p ('</script>');  
    END IF; 
    END;
    Regards,
    Sushant

    Hi Kiran,
    I have created two process -- On Load - After Header
    1)  Sequence=10
    Declare Output VARCHAR2 (20);
    begin
    Output := 1;
    Output := NVL( :AI_ORGANIZATION_ID , 0);
    IF Output  = '0'  THEN
       APEX_UTIL.SET_SESSION_STATE('AI_ORGANIZATION_CODE','');
       HTP.p ('<script type="text/javascript">');
       HTP.p ('alert("No Organization selected.\n Please select an Organization");' );
       HTP.p ('</script>'); 
    END IF;
    END;
    2) Sequence=20
    Declare Output VARCHAR2 (20);
    begin 
    Output := 1;
    Output := NVL( :AI_ORGANIZATION_ID , 0);
    IF Output  = '0'  THEN
       htp.init;
        owa_util.redirect_url('f?p=&APP_ID.:1:&APP_SESSION.');
    ELSE
    htp.init;
    owa_util.redirect_url('f?p=&APP_ID.:4:&APP_SESSION.');
    END IF;
      END;
    but after click on tab directly it is not showing the pop-up message and directly going to home page. I want when I click on pop-up message to OK then it need to redirect the home page also from home page when I am selecting any organization and trying to go on tab it is not going maybe due to owa_util.redirect_url. Please advise.
    Regards,
    Sushant

  • How to redirect a page that does not exist

    Hello everyone. Thanks for the feedback so far.
    I am editing an old site and there are going to be some pages that do not exist anymore.
    Is there a way to have an automatic redirect so that if any user types in ANY page that does not exist sitewide, they can be directed to another main redirection page which displays a message and then to the main page again?
    The current site is littered with empty pages with a redirect link on each at the moment which does not look good and it's awful to maintain as these non-meaningful filenames the original developer has used are no help at all.
    Thank you in advance for all feedback
    Terry

    What is the web address of the old site?
    If it's on a Linux server then you can use .htaccess rewrites to automate much of the redirection heavy lifting
    http://kb.mediatemple.net/questions/85/Using+.htaccess+rewrite+rules#gs
    https://my.bluehost.com/cgi/help/htaccess_redirect

  • How to redirect a page on iweb

    Hi I have an online store @ cafepress that I built with them..Is there a way to create a page on Iweb that visitors click (the tab) and are then taken to that specific page or is there a way to embed that page into an iweb page....any help would be appreciated.

    You can make an external link for taking visitors on that page or you can embed that page in yours through an iframe but that doesn't work very well so I wouldn't recommend you to do that.
    Reagrds,
    Cédric

  • How can i redirect a page to Login screen when sessionis timeout???

    I have a problem in my portal development.
    I set the "<b>Session timeout= 01</b>" parameter in the<b> Visual Administrator</b>
    server_0 > services > Web Container
            Runtime > sap.com/irj  > irj    (view button)
    However, when the session is timeout then the page become to be "red"!!! That is, there is an Exception. I'd like to redirect the page to the "Login screen", but I don't know how. <b>Does anybody know how can I do it</b>?
    Thanks in advance.

    Hi,
        the http session invalidation must be checked at application level  do it DYNPAGE only .you can call the following method.
    public void expireSession(IPortalComponentRequest request)
              long lastAccessedTime=request.getServletRequest().getSession().getLastAccessedTime();
              Date currentDate = new Date();
              Calendar currentDateCal = new GregorianCalendar();
              currentDateCal.setTime(currentDate);
              long systemTime = currentDateCal.getTimeInMillis();          
              long sessionExpiryTime = systemTime - lastAccessedTime;
              long sessionExpiryTimeProp = 600000; //dont hard code.get from property file
              if(sessionExpiryTime >= sessionExpiryTimeProp)
                   try
                       IPortalComponentResponse response=(IPortalComponentResponse)this.getResponse();                    
                        String sessionExpiryPage ="/irj/servlet/prt/portal/prtroot/com.sap.portal.masthead.LogOutComponent?logout_submit=true";                    
                        response.write ("<script language="javascript">");
                        response.write("parent.window.location.replace('"+sessionExpiryPage+"','','toolbar:No,status: No,location: N0');");
                        response.write("</script>");
                   }catch(Exception e)     

  • How do I stop firefox from redirecting every page I click on in Google search? No matter what I search for in Google when I click on it Firefox redirects me to some other search, sales, or contest page.

    How do I stop firefox from redirecting every page I click on in Google search? No matter what I search for in Google when I click on it Firefox redirects me to some other search, sales, or contest page. I have a security program running, no maleware, adware, or virus on my pc. Thanks for the help in advance.

    Sounds like a dose of search redirect malware or a redirect virus.
    Install, update, and run these programs in this order. They are listed in order of efficacy.<br />'''''(Not all programs detect the same Malware, so you may need to run them all to solve your problem.)''''' <br />These programs are all free for personal use, but some have limited functionality in the "free mode" - but those are features you really don't need to find and remove the problem that you have.<br />
    ''Note: If your Malware infection is bad enough and you are mis-directed to URL's other than what is posted, you may have to use a different PC to download these programs and use a USB stick to transfer them to the afflicted PC.''
    Malwarebytes' Anti-Malware - [http://www.malwarebytes.org/mbam.php] <br />
    SuperAntispyware - [http://www.superantispyware.com/] <br />
    AdAware - [http://www.lavasoftusa.com/software/adaware/] <br />
    Spybot Search & Destroy - [http://www.safer-networking.org/en/index.html] <br />
    Windows Defender: Home Page - [http://www.microsoft.com/windows/products/winfamily/defender/default.mspx]<br />
    Also, if you have a search engine re-direct problem, see this:<br />
    http://deletemalware.blogspot.com/2010/02/remove-google-redirect-virus.html
    If these don't find it or can't clear it, post in one of these forums for specialized malware removal help: <br />
    [http://www.spywarewarrior.com/index.php] <br />
    [http://forum.aumha.org/] <br />
    [http://www.spywareinfoforum.com/] <br />
    [http://bleepingcomputer.com]

  • How to redirect to different page after login in APEX 4.1

    Dear All,
    Here my Requirement is,When the users login,
    when they entered their username and password and pressed login button,
    they have to redirected to different pages based on the type of user.
    Here my LOGIN_TABLE has following 3 columns,
    1.Username
    2.Password
    3.Type.
    The TYPE has 2 values, employee and admin.
    when the type is admin they should be redirected to page 2,
    reaining i.e employee users has to be redirected to page 3.
    How can I do this? please give some suggestion.
    Thank you.
    regards,
    Gurujothi

    Dear Christian,
    Thank you for your reply,
    I would like to explain something,
    When I using the following function,
    *create or replace FUNCTION custom_auth_g (
    p_username IN VARCHAR2,
    p_password IN VARCHAR2)
    RETURN BOOLEAN IS
    BEGIN
    FOR c1 IN (SELECT 1
    FROM login_table
    WHERE upper(username) = upper(p_username)
    AND upper(password) = upper(p_password))
    LOOP
    RETURN TRUE;
    END LOOP;
    RETURN FALSE;
    END;*
    When login, It checks in the login_table table and if the username is exist with the pass word it successfully entered inside the application.
    for all users only one page which we set.
    My Login_table also contains type which has 2 type as I mentined above.
    But As I mentioned earliar based on the user type it has to be redirected to 2 different page.
    I found this Package but I cant understand,Can you please Explain?
    *create or replace PACKAGE app_security_pkg
    AS
    PROCEDURE add_user
    p_username IN VARCHAR2
    ,p_password IN VARCHAR2
    PROCEDURE login
    p_uname IN VARCHAR2
    ,p_password IN VARCHAR2
    ,p_session_id IN VARCHAR2
    ,p_flow_page IN VARCHAR2
    FUNCTION get_hash
    p_username IN VARCHAR2
    ,p_password IN VARCHAR2
    RETURN VARCHAR2;
    PROCEDURE valid_user2
    p_username IN VARCHAR2
    ,p_password IN VARCHAR2
    FUNCTION valid_user
    p_username IN VARCHAR2
    ,p_password IN VARCHAR2
    RETURN BOOLEAN;
    END app_security_pkg;*
    *create or replace PACKAGE BODY app_security_pkg
    AS
    PROCEDURE login
    p_uname IN VARCHAR2
    ,p_password IN VARCHAR2
    ,p_session_id IN VARCHAR2
    ,p_flow_page IN VARCHAR2
    IS
    lv_goto_page NUMBER DEFAULT 1;
    BEGIN
    -- This logic is a demonstration of how to redirect
    -- to different pages depending on who successfully
    -- authenticates. In my example, it simply demonstrates
    -- the ADMIN user going to page 1 and all other users going
    -- to page 2. Add you own logic here to detrmin which page
    -- a user should be directed to post authentication.
    IF UPPER(p_uname) = 'ADMIN'
    THEN
    lv_goto_page := 1;
    ELSE
    lv_goto_page := 2;
    END IF;
    APEX_UTIL.SET_SESSION_STATE('FSP_AFTER_LOGIN_URL');
    wwv_flow_custom_auth_std.login
    p_uname => p_uname,
    p_password => p_password,
    p_session_id => p_session_id,
    p_flow_page => p_flow_page || ':' || lv_goto_page
    EXCEPTION
    WHEN OTHERS
    THEN
    RAISE;
    END login;
    PROCEDURE add_user
    p_username IN VARCHAR2
    ,p_password IN VARCHAR2
    AS
    BEGIN
    INSERT INTO app_users (username, PASSWORD)
    VALUES (UPPER (p_username),
    get_hash (TRIM (p_username), p_password));
    COMMIT;
    EXCEPTION
    WHEN OTHERS
    THEN
    ROLLBACK;
    RAISE;
    END add_user;
    -- Function to Perform a oneway hash of the users
    -- passwords. This cannot be reversed. This exmaple
    -- is a very week hash and if been used on a production
    -- system, you may want to use a stronger hash algorithm.
    -- Read the Documentation for more info on DBMS_CRYPTO as
    -- this is the supported package from Oracle and
    -- DBMS_OBFUSCATION_TOOLKIT is now depricated.
    FUNCTION get_hash (p_username IN VARCHAR2, p_password IN VARCHAR2)
    RETURN VARCHAR2
    AS
    BEGIN
    RETURN DBMS_OBFUSCATION_TOOLKIT.md5 (
    input_string => UPPER (p_username)
    || '/'
    || UPPER (p_password));
    END get_hash;
    PROCEDURE valid_user2 (p_username IN VARCHAR2, p_password IN VARCHAR2)
    AS
    v_dummy VARCHAR2 (1);
    BEGIN
    SELECT '1'
    INTO v_dummy
    FROM app_users
    WHERE UPPER (username) = UPPER (p_username)
    AND PASSWORD = get_hash (p_username, p_password);
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN raise_application_error (-20000, 'Invalid username / password.');
    END valid_user2;
    FUNCTION valid_user (p_username IN VARCHAR2, p_password IN VARCHAR2)
    RETURN BOOLEAN
    AS
    BEGIN
    valid_user2 (UPPER (p_username), p_password);
    RETURN TRUE;
    EXCEPTION
    WHEN OTHERS
    THEN RETURN FALSE;
    END valid_user;
    END app_security_pkg;*
    And you said "assign an URL to FSP_AFTER_LOGIN_URL, depending on the Type column",
    Where to assign,Could you please Explain?
    Thank you.

  • How to redirect to other page in a dialogListener?

    Hi All,
    I am using JDeveloper 11g with ADF BC.
    How to redirect to another page from a dialogListener of <af:dialog>?
    I have a page with a [Delete] button on it. When user click on the delete button, a confirmation dialog will appear to ask "Are you sure? [Yes/No]". If user answer [Yes], I will delete the current record, and go to another page. I can call a Operation Binding in the dialogListener, but I don't know how to go to another page.
    public void handleDeleteDialog(DialogEvent dialogEvent) {
    OperationBinding operationBinding = bindings.getOperationBinding("Delete");
    Object result = operationBinding.execute();
    if (!operationBinding.getErrors().isEmpty()) {
    // redirect to another page?
    Regards,
    Samson Fu

    Hi Samson,
    Check following link for your query:-
    Re: page has to navigate to the next page when  clicking button in the popup
    You can also make usae of Navigation Handler to invoke the navigation action in your task flow as
    FacesContext facesCtx = FacesContext.getCurrentInstance();
    NavigationHandler nh = facesCtx.getApplication().getNavigationHandler();
    nh.handleNavigation(facesCtx, "", "ActionNameInTaskFlow");
    Vikram

  • How to redirect users to Custom Page on InfoView logoff

    Post Author: Srinivas123
    CA Forum: WebIntelligence Reporting
    How to redirect the users on InfoView logoff to a custom page, instead of the default logon.aspx.   

    Hello Senana,
    Assuming you're using wwv_flow_custom_auth_std.login to log in, and p_flow_page is set to "[your app id]:1" try placing the following line just before your call to wwv_flow_custom_auth_std.login:
    :FSP_AFTER_LOGIN_URL := null;This should force user to page 1 after log-in.
    Hope this helps,
    John

  • How to redirect to a page (without branching and without pl/sql)

    Hi,
    Have a requirement where when a user log into the application, the APP_USER must be checked against the list of users maintained in a database table, if APP_USER name exist in the table, the user must be redirected to the home page else user must be redirected to the Registration page.
    Tried the branching concept:
    Branch Point: On Load: Before Header
    Condition: NOT Exists (SQL Query returns no rows)
    Expression1 : select * from users_tab where name = v('APP_USER')
    When this condition is given, though the user name does not exist in the users_tab, the page is redirected to page 1 instead of the Registration page.
    Where is the problem here?
    How can it be resolved?
    Is there an alternative way to implement this?
    Edited by: 935799 on Jun 7, 2012 6:51 AM

    935799 wrote:
    Hi,
    Have a requirement where when a user log into the application, the APP_USER must be checked against the list of users maintained in a database table, if APP_USER name exist in the table, the user must be redirected to the home page else user must be redirected to the Registration page.
    Tried the branching concept:
    Branch Point: On Load: Before Header
    Condition: NOT Exists (SQL Query returns no rows)
    Expression1 : select * from users_tab where name = v('APP_USER')
    When this condition is given, though the user name does not exist in the users_tab, the page is redirected to page 1 instead of the Registration page.
    Where is the problem here?
    How can it be resolved?
    Is there an alternative way to implement this?
    Edited by: 935799 on Jun 7, 2012 6:51 AMThe above should work, try this
    select * from users_tab where upper(name) = nvl(:APP_USER,'X')

  • How to redirect to a page dynamic

    Hello everyone,
    I have the code bellow in public void init() of a fragment page.
    My problem is how to call a page in a dynamic way... if the codigoUsuario is null
    try{
    if (getRequestBean1().getCodigoUsuario()!=null){
    getTb_usuarioRowSet().setObject(1,
    getRequestBean1().getCodigoUsuario());
    }else{
    //code here to go to Login.jsp
    }catch(Exception e){
    log("ErrorDescription", e);
    error(e.getMessage());
    Please someone... help me
    thank�s
    Gustavo Callou

    I have already solve this problem with
    this.getExternalContext().redirect("/Patrimonio/faces/Login.jsp");

  • 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

  • How to redirect user from login page to "Set Challenge question" page

    How to redirect user from login page to "Set Challenge question" page (NOT custom page) after 3 un successful password attempts?
    Meaning when user types wrong password 3 times they will be redirected to set Challenge question page. If user answers the challenge question then password reset page should be appeared other wise (after remaining 3 un successeful challenge question answers) account should be locked out.
    thanks for your help.

    hi sandeep
    Thanks for your answer. Let me ellaborate more on the requirement here.
    - Password Policy and Lost Password management are set up in the identity system
    - Configure login tries allowed= 5. Verify accout is lock out after 5 unsucessful login.
    This is what need to achieve.
    1) If a user attempts to login 3(not 5) times using an incorrect login credential he/she should be redirected to set challenge question (security question) page.
    2) Then if the user attempts (remaining) 2 times incorrect challenge answer then his/her account should be locked out.
    3) If he/she answers the challenge answer correctly then he/she should be redirected to password reset page.
    Is this possible?

  • How to redirect page after session time out-Urgent

    I want to redirect my page once the session time out..
    plz let me knw its very urgent

    HI
    i too got the same problem. At present i fsession expires i'm farwarding it to Some general login page. But we've diffenternt employers with differnet login pages. How can i farward to login page wich the use entered in previously
    For this i got one solution buti don't how to implement it.
    After login page i'll send one value as parameter to Servelt controller.This value ,i append as query string to all requests which are going through the Servelt. And i'll retrive this value from the URL referal. whenever session expires i'm farwarding to some Session Expired JSP . There i want to check this varibale's and depanding on that i'l farward to particular login page.
    This is in my mind . Can any help me how to Implement this.
    Satya

Maybe you are looking for

  • How do you print data from a form?

    From the interactive report, there's a built in function to print to variious formats (e.g., PDF, CSV, etc). As long as the columns do not exceed the width of a page, it's okay. But what I want to do is when a user clicks on 'edit' from the interacti

  • I updated to IOS 6 and now it is frozen with a picture of a cord to connect to ITunes

    Hi I updated to IOS 6 on my IPod touch and now it is frozen with a picture to connect to ITunes

  • Clicking mouse after closing JDialog sends event to last component (1.1.8)

    There seems to be a bug in Java 1.1.8 that I'm looking for a workaround. I have a JButton on a JFrame that brings up a modal JDialog when you click it. After closing the dialog, if you click on the JFrame without moving the mouse, it will click the b

  • MC$4 Vs FK10N

    HI Why there is difference between  MC$4 and FK10N Values. If I compare the debit amount from FK10N with Invoice amount figure from MC$4 for a prticular period there is huge difference. What is the basic fictionally between these two and If I want to

  • APEX Web Service

    Hi All, I'm trying to use APEX webs service to make a restful request, the built in API is not working for me and I have spent long hours to fix it but could not. The documentation on this API is little and searching the internet did return much. bas