Redirect from Constructor

Hi,
I am facing a problem in JSR-168 JSF protlet while redirecting from the Page Bean constructor. I am using the following code:
getFacesContext().getApplication().getNavigationHandler().handleNavigation(getFacesContext(), null, "case2");The same code works fine when used in the click event of the button.... but I want to do it on load the page.
The scenario is: I want to show my own login page when the portlet is loaded, so on load I check a value of a flag from session if it is 0 then go to login page otherwise open the same page.
Any idea how to solve this issue?

i try to handle with it in that way
FacesContext context = FacesContext.getCurrentInstance();
UIViewRoot view = UIViewRoot)context.getApplication().getViewHandler().createView( context, "/exception.jsf");
context.setViewRoot(view);
context.renderResponse();but it's still not working correct. i go to this page by <t:commandNavigation2 value="Manage" action="managePersons"/>. page even this is displayed. when i click comand nawigation again page is redirecting. when i refresh page from browser redirect not working.
the same was doing with
FacesContext facesContext = FacesContext.getCurrentInstance();
facesContext.getExternalContext().redirect("databaseexception.jsf");
facesContext.responseComplete();any idea? thanks form help.

Similar Messages

  • Redirect from the constuctor of the page

    I try to redirect from the constructor of the page using the code from the dynamic navigation tutorial:
    Application application = getApplication();
    NavigationHandler navigator = application.getNavigationHandler();
    FacesContext facesContext = getFacesContext();
    navigator.handleNavigation(facesContext, null, "page2");
    but it doesnt work neither it gives me any error.
    when i do the same with a dropdown menu like the tutorial it works fine.
    if this doesnt work is there any other way to redirect from the constuctor. ?
    Thanks
    Marios

    So, is there a valid way to use JSF Navigation from a backing bean's constructor or do I have to live with this hack:
    FacesContext.getCurrentInstance().getExternalContext().redirect( "newPage.jsp" );Thanks for the clarification.

  • How to redirect from list edit form to another page using jquery in sharepoint 2013

    hi friends i have been trying to find a way to redirect from list edit form to another page using javascript and jquery
    i found lot of codes online but non of them are working for me.
    what i need is i have to save the data in the form and after that it has to redirect to another page. it has to get the url from hyperlink field of the item.
    please help me in this regards

    Not sure if you have gone through below links:
    http://spservices.codeplex.com/wikipage?title=%24().SPServices.SPRedirectWithID
    http://blogs.askcts.com/2013/02/18/using-spservices-and-jquery-to-perform-a-redirect-from-a-sharepoint-list-newform-to-editform/
    Please ensure that you mark a question as Answered once you receive a satisfactory response.

  • How to pass on variables while redirecting from BSP to HTML  page.

    Hi all,
    I have two BSP pages - BSP1, BSP2.  When I click a submit button on BSP1, it should call BSP2 wherein BSP2 will work silently behind the scenes and redirect some variable values through hidden form fields to BSP1 back. 
    User will not see BSP2 in fact.  He just deals with BSP1, but when he clicks the submit button on BSP1, it silently calls BSP2, and then BSP2 will process something behind the scenes and sends back values through hidden form fields to BSP1 by means of redirection. After redirection from BSP2 to BSP1, I am not getting the hidden fields in BSP1.  From the BSP1, I am trying to get the hidden fields of BSP1 using:
    Here is how my code in BSP2 (redirecting to BSP1) looks like:
    <b>BSP2 : Layout:</b>
    <input type="hidden" name="hf1" value="vicky">
    <b>BSP2 : OnInitialization:</b>
      response->redirect( url_BSP1 ).
      navigation->response_complete( ).
    But when I am doing this, the hidden form fields from BSP2 are not being passed to BSP1 back.
    I am trying to get the form values <b>in BSP1</b> as below:
    <b>BSP1 : Layout:</b>
       <%
       data:  hfield type string.
       hfield = request->get_form_field('hf1').
       %>
    I even tried the above code in onRequest, and onInitialization sections.  But I am getting nothing.
    Please give me some ideas on how to deal with the redirection and get the hidden values out of that.
    Thanks in advance.
    Cheers,
    Vicky.

    Hi,
    There are different ways to do it, but let's pick this one. It closes the popup. If you need additional things to be done, you can make a form with all hidden fields, submit that form, do the same close and do whatever you need in the inputprocessing
    <html>
      <head>
    <title>title</title>
          <script language="javascript">
              function init() {
              <%if count eq 1.%>
                  opener.document.form.F<%=field%>.value = '<%=value.%>';
              close();
             <%else.%>
          <%endif.%>
          </script>
      </head>
      <body onLoad="init();">
    </body>
    </html>

  • How to create HTTP 301 redirect from UCM 7.5.2

    Is it possible to send a HTTP response with a permanent redirect from a UCM/Stellent website? We're using version 7.5.2 with iDoc script.
    We can use the iDoc function setHttpHeader() to send the Location HTTP header, but how to send the HTTP response code 301, to signal the permanent redirect to the browser?

    Hi Rob,
    If you are using IIS there is a config variable that allows you do this. First create a virtual directory in IIS point to <install dir>\Inetpub\wwwroot directory.
    and then do the below steps
    a.     Login to Content Server
    b.     Click on Administration Admin Server
    c.     Click on Content Server instance name(button)
    d.     Click on General Configuration
    e.     Update SSWebFilterIgnoreList configuration variable
    f.     SSWebFilterIgnoreList=virtualDirectory There should not be any spaces
    g.     Click on save
    h.     Restart Content Server
    Let me if this is what you are looking for.
    regards,
    deepak

  • Getting URL redirects from Google's "I'm Feeling Lucky" Search

    Hello all! I'm working on my final project for my intermediate programming class but I've hit a bit of a snag. This project is a "do whatever interests you, as long as it incoporates what we've learned this semester" type of project. (My personal favorite type of programming project!) I have a significant amount of code already complete, but here's my problem:
    To put it simply, my program:
    1) Takes a list of movie names
    2) Gets the movie poster from Wikipedia
    3) Saves the poster images to a folder
    4) Creates an HTML file, so I can see a visual representation of every movie on the list (btw, how do you like my idea?).
    I'm using (what I think to be) a very clever system of searching with Google's "I'm Feeling Lucky" search (using detailed search terms such as "air+force+one+movie+wikipedia" that will, more than likely, always take me to the right page (if it exists))...
    Basically, my getPic(String url) method is now throwing an exception when I try to search the page that Google redirects me to, and I'm guessing it might be because the code is trying to search the "I'm Feeling Lucky" redirect page, instead of the page it is supposed to redirect to.
    I get the following error:
    10000 BC
    A connection to http://www.google.com/search?btnI=1&q=10000+bc+movie+wiki could not be established.
    java.io.IOException: Server returned HTTP response code: 403 for URL: http://www.google.com/search?btnI=1&q=10000+bc+movie+wiki
         at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
         at java.net.URL.openStream(Unknown Source)
         at GetWikiPiki.getPic(GetWikiPiki.java:44)
         at MovieList.makeMovieList(MovieList.java:109)
         at MakeMovieList.main(MakeMovieList.java:13)(Etc, with all the movies giving the same exception.)
    If my guess is correct, could someone please inform me on how to either:
    a) Follow the redirection from Google to the Wikipedia page or
    b) Obtain the URL which the Google search will redirect me to.
    Preferably b, so I can program it not to need to recreate each movie search every time the program runs.
    Or if you have another idea of what it could be, please feel free to make suggestions.
    Thanks a lot,
    Derek

    When I tried printing the source of, for example, http://www.google.com/search?btnI=1&q=10000+bc+movie+wiki it gave me the source code to the Wikipedia 10,000 BC page with no errors at all.
    Does this mean that it could be something wrong in my code and not Google?
    Here is the code I'm using in the particular section that throws an exception:
          * Gets the image address of a movie poster from Wikipedia via
          * parsing the passed-in URL.
          * @param url The website address (URL) of a Wikipedia article containing a movie poster.
          * @return The first occurrence, in "picture_name.jpg" format, of an
          * image whose address contains "http://" and ".jpg".
    public String getPic(String url) {
              try {
                   URL connection = new URL(url);
                   InputStream in = connection.openStream();
                   Scanner console = new Scanner(in);
                   while(console.hasNext()) {
                        String temp = console.next();
                        if(temp.contains("http://") && temp.contains(".jpg")) {
                             String temp2 = temp.replace("src", "").replace("=", "").replace("\"", "");
                             return temp2;
              catch(IOException e) {
              System.out.println("A connection to " + url + " could not be established.");
              e.printStackTrace();
              return null;
         }{code}
    Edited by: NovellTerminator on Apr 8, 2009 2:36 AM
    Edited by: NovellTerminator on Apr 8, 2009 2:40 AM (Included JavaDoc)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Yahoo mail redirects my email page to another trap page that asks me to upgrade. Is there an extension I can use to redirect from that site?

    I would like to know if there's an extension, or if I need to write a script so that Firefox will stop a redirect to a trap yahoo page, that yahoo causes when I try to access my yahoo mail account. Yahoo redirects from my email page every time I try to access it. I can force my way back to email if I highlight the following from the address bar and delete it: /neo/trap?dm=cl&ncrumb=IvdoOqzobdy&.rand=1254591153
    That address qualification appears when I try to access "mail.yahoo.com"
    If there is no extension I can use, can you explain what I should use to write a script? And where I can research to learn how to write it.
    If you could point me in the right direction I would really appreciate it.

    ok, you could use the greasemonkey extension & this userscript: http://userscripts.org/scripts/show/113518 (i haven't tested it myself, but judging from the description it may apply to your case)

  • How to make a redirect without auto-redirect from the portlet "edit" mode?

    How to make a redirect without auto-redirect from the portlet "edit" mode?
    I use some sofisticated customizing with server-side validation of the form data. I want to redirect to the page of the portlet "show" mode and to the "edit" mode depending on the validation results. How can I do it?

    Heay.....this worked for me.
    I am able to change the mode programatically from edit to show.
    HttpPortletRendererUtil.handleEditAction(portletRenderRequest,"OK");
    I removed Apply , OK and Cancel buttons and applied my own Submit and Back button in Personalize mode and then change the mode to show on click of Back button using the above mentioned statement.
    Thanks
    ~Neeraj Sidhaye
    Try_Catch_Finally @ Y !
    ExtremePortal @ Gmail&#12288;&#65316;&#65359;&#65364;&#12288;&#65315;&#65359;&#65357;

  • Redirecting from an abstract portal component

    Hi,
    I'm trying to redirect from an abstract portal component to a quicklink. I do it like told in this thread:
    Redirecting to external website from abstract portal component?
    private void redirectUrl(String target, IPortalComponentRequest request) {
      try {
        HttpServletResponse resp = request.getServletResponse(true);
        resp.sendRedirect("../../../../portal/" + target);
      } catch (IOException e) {}
    It works, but the content of my target-URL is still in the Portal-Frame. So I've two time the Portal-Framework-Navigation. Something like this:
    | Welcome         |
    | Welcome         |
    | content         |
    |                 |
    |                 |
    |                 |
    My goal is to redirect the whole page, not only the frame.
    Thanks for any help...
    Regards, Markus

    Perhaps I can do it with
      public void doOnNodeReady(IPortalComponentRequest request){
        request.redirect("http://www.google.de");
    But like in this Tread, it didn't work AbstractPortalComponent and doOnNodeReady

  • SolMan 7.1 SPS 11 - deactivate redirect from HTTP to HTTPS

    Hi Gurus,
    I am currently experiencing the case, that I can't call HTTP pages anymore.
    Before I made the check described under SOLMAN_SETUP -> System Preparation -> 2. Check Installation -> Manual Activities -> Check Secure Web Browser Comm. (HTTPS) I was able to call SOLMAN_SETUP with HTTP and SSO worked (starting the Browser by calling transaction SOLMAN_SETUP in GUI).
    After I have executed the check, I have changed nothing but to execute the check and make sure there is a working HTTPS service.
    Now I am experiencing the case that if I start transaction SOLMAN_SETUP I get a browser call HTTPS. If I change the protocol and the port to HTTP it jumps directly to HTTPS. This behavior makes me think that some configurations steps have activated a force redirect from HTTP to HTTPS.
    This specially gives me some headache because all other (satellite)-systems are not configured to use secured communication and the certificates are not rolled out.
    Currently I can't afford the need to roll out certificates all over the landscape.
    To buy me some more time:
    How can I check if my feeling about the redirect is correct?
    If there is a redirect, how can I disable this so that I can work with HTTP-URLs?
    I appreciate your help.
    Kind regards,
    Niklas Theis

    Hi Niklas,
    Perhaps this note can give You a little hint how to reverse to the HTTP setting again:
    1716999 - Enable HTTPS for Solution Manager web service communications
    Also check and adjust if necessary the setting for the webservice  “wd_sise_main_app”: Change the setting to “Switch to HTTP”.
    In addtion to that You also might look into:
    - the ACL file; if any block against HTTP has been setup
    Regards,
    Kurt

  • I am unable to download pdf which is redirected from flex in google chrome...

    I am unable to download pdf which is redirected from flex in google chrome...  Although it works fine in other browsers .... and also more one thing is that it happens when it uses flash/Flex to redirect the pdf in modal popup

    When you write "download", do you mean download, or open in the Chrome PDF viewer?

  • Redirecting from a template based webpage

    I would like to automatically redirect from one webpage to
    another. The problem is that the first webpage was created and a
    template was applied to it, so now when I try to "Insert/HTML/Head
    Tags/Refresh" Dreamweaver cannot apply the refresh because the
    template has locked the head region. How can I automatically
    redirect from a webpage that has an uneditable head, or how do I
    make the head region of the template editable so that a "Refresh"
    redirect can be added to the head tag?

    Insert the editable region in the head using Code view
    Walt
    "buckeyestargazer" <[email protected]> wrote
    in message
    news:gc0i8q$a30$[email protected]..
    > Walt, thanks for the reply. This is what I originally
    tried to do in the
    > template. Unfortunately, no matter where I try to insert
    an editable
    > region in
    > the <head></head> for some reason it inserts
    the editable region AFTER the
    > </head> and when I then try to insert the refresh
    in the webpage based on
    > the
    > template, it will not let the change take place and
    discards the action.
    > Here's the code to the head of the template, if it
    helps:
    >
    > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN"
    > "
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    > <html xmlns="
    http://www.w3.org/1999/xhtml">
    > <!-- DW6 -->
    > <head>
    > <!-- Copyright 2005 Macromedia, Inc. All rights
    reserved. -->
    > <title>Buckeyestargazer.net</title>
    > <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1" />
    > <link rel="stylesheet" href="../mm_spa.css"
    type="text/css" />
    > <style type="text/css">
    > <!--
    > .style1 {
    > font-size: 18px;
    > color: #FF9900;
    > }
    > .style2 {color: #FF9900}
    > .style3 {font-size: 12px}
    > -->
    > </style>
    > <script src="../Scripts/AC_RunActiveContent.js"
    > type="text/javascript"></script>
    > </head>
    >

  • Redirecting from one application to another

    Hi All,
    Anybody please tell me how to redirect from one application to another.
    I have two application one is a1 and second is a2 inside orion.
    a1 has a jsp file named a1index.jsp. and a2 has a jsp file named a2index.jsp.
    in a1index.jsp file I am using response.sendRedirect("\a2\a2index.jsp") and redirecting to a2index.jsp. But it doesn't open a2index.jsp file as the syntex is not correct. .
    Anybody please tell me what is the correct syntax to redirect from one application jsp to another jsp...
    please reply soon..
    Thanks in advance.......

    thanks for your reply, but it is giving following
    error.......
    Error parsing JSP page /admin/login.jsp
    Syntax error in source/admin/login.jsp.java:23:
    cannot resolve symbol (JSP page line 2)
    symbol  : variable RequestDispatcher
    location: class /admin/login.jsp
    RequestDispatcher =
    getServletContext().getContext("a2/fabricatoradmin").g
    etRequestDispatcher("\fablogin.jsp");
    ^
    /admin/login.jsp.java:23: cannot resolve symbol (JSP
    page line 2)
    symbol  : method getServletContext ()
    location: class /admin/login.jsp
    RequestDispatcher =
    getServletContext().getContext("a2/fabricatoradmin").g
    etRequestDispatcher("\fablogin.jsp");Thanks
    please reply..Inside a jsp file u can use the application variable instead of using
    getServletContext()
    like application.getContext("/a2").getRequestDispatcher("/fabricatoradmin/fablogin.jsp");
    regards
    Pravin

  • SSO problem when redirecting from a JSP page to an external application

    Hi,
    I try to make a redirect from a JSP page (that is under a SSO protected application on iAS) to another page from another application, on an external iAS server, also protected by (a different) SSO. After the redirection is done, the login window appears, I enter the login name and the password and after that I obtain the followin error:
    "Oracle SSO Failure - Unable to process request
    Either the requested URL was not specified in terms of a fully-qualified host name or OHS single sign-on is incorrectly configured.
    Please notify your administrator."
    In the logs og the server I found the following:
    [OSSO] W05: Requested URL is not specified in terms of fully-qualified host name or invalid SSO partner configuration. Host from request
    mycompany.com:7777, registered host 144.147.147.200:7778.
    (the ip address being the address of the mycompany.com host).
    Any clue about this? Thanks a lot in advance!
    Regards,
    Marinel

    Hi Carlo,
    Thanks for your answer.
    The JSP original page is not added as a partner application to the second SSO server.
    The idea was that the user should insert first the login name/passwd for the first server, after being logged in, then redirected to the second application (on a different server), insert the login name/password for the second application and then load the 2nd application page. It seems that is not working after inserting the password for the 2nd application.
    Coming to a more general question that could help me to avoid this complicated approach: is it possible to have two different applications deployed on two different iAS servers and the two applications to use the same SSO (let's say the one from the first iAS server)? I have to mention that the process scenario is the following: the user load a page from the first application (protected by SSO), then, after successfull login and some processing in the first app, he will be automatically redirected by the first app to the second application, on the second server. I want to have also the second application, on the 2nd server, protected by SSO (ideally would be the same SSO as the first one!). Ideally the scenario would be: if it is redirected from the first app and the user is already authenticated, the automatic redirection should be done transparently for the user (without enetring the password again). If the user goes directly from the browser to a page of the second app, the SSO login window should be displayed and the user should provide his password.
    Is such a scenario possible on two apps deployed on two different servers?!
    Thanks a lot again!
    Regards,
    Marinel

  • I get redirected to unwanted web sites during searches from the browser ONLY, never from the toolbar. Is this the same malware problem as discribed for redirects from BOTH the browser and the toolbar?

    I get redirected to unwanted web sites during searches from the browser ONLY, never from the toolbar. Is this the same malware problem as discribed for redirects from BOTH the browser and the toolbar?
    == This happened ==
    Every time Firefox opened
    == was happening with Internet Explorer, continues with Firefox

    Did you do a malware check?
    Do a malware check with a few malware scan programs.
    You need to use all programs because each detects different malware.
    Make sure that you update each program to get the latest version of the database.
    http://www.malwarebytes.org/mbam.php - Malwarebytes' Anti-Malware
    http://www.superantispyware.com/ - SuperAntispyware
    http://www.safer-networking.org/en/index.html - Spybot Search & Destroy
    http://www.lavasoft.com/products/ad_aware_free.php - Ad-Aware Free
    http://www.microsoft.com/windows/products/winfamily/defender/default.mspx - Windows Defender: Home Page
    See also "Spyware on Windows": http://kb.mozillazine.org/Popups_not_blocked and [[Searches are redirected to another site]]
    (the MozillaZine KB is currently down, so you may need to try again later)

Maybe you are looking for

  • Testing the File sender from local computer

    Hi Gurus, I know that this is a very low level question. I am working on a File-XI-IDOC interface. I wanted to keep the file on my computer. How to set the file adapter sender which can pick up the file from my machine. I have downloaded WS-FTP Serve

  • Oracle Portal Load Balancing question

    Our customer wishes to have multiple Oracle Application Servers running Oracle Portal, with load balancing. They would like to have Web Cache collocated with one of these Portal servers, operating as a load balancer for the Portal servers (including

  • How to hide Date/Time in TagQuery

    hai all can any body tell how to hide or eliminate Date/Time in tag Query while displaying in  a html file is it possible to display the tag values with out Date and Time plz help me Thanks in Advance Apsara

  • HT2293 Do i need nike+ sensor with iPod nano 6.generation?

    Do i need nike+ sensor with iPod nano 6.generation?

  • Possible Fix for Random Video Chat Error!

    Recently, I was having problems starting video chats. They would start, then disconnect. I figured out I had installed a program called tinyproxy. It interfered with iChat. If you have installed tinyproxy or another similar program, follow the steps