[JSF2] Redirect after post, flash scope, keepMessages

Hi,
I'm using the redirect-after-post (or post-redirect-get) pattern [1] in a JSF2 application. To preserve the faces messages until the next request (get), I call FacesContext.getCurrentInstance().getExternalContext().getFlash().setKeepMessages(true) before returning the redirect as a result from my action method.
All works fine, however, if I keep redirect-after-posting through my application, these messages never disappear. I have to manually clear them before issuing another redirect as in:
    private static void removeRenderedMessages(FacesContext ctx) {
        final Iterator<FacesMessage> msgIterator = ctx.getMessages();
        while (msgIterator.hasNext()) {
            if (msgIterator.next().isRendered()) {
                msgIterator.remove();
    }Is this a bug or a feature (I'm using Mojarra 2.0.2 in Glassfish 3 web profile)? I was under the impression that variables in flash scope survive for exactly one request.
Cheers,
Daniel
[www.flexive.org|http://www.flexive.org]
[1] [http://en.wikipedia.org/wiki/Post/Redirect/Get|http://en.wikipedia.org/wiki/Post/Redirect/Get]

Hi,
I'm using the redirect-after-post (or post-redirect-get) pattern [1] in a JSF2 application. To preserve the faces messages until the next request (get), I call FacesContext.getCurrentInstance().getExternalContext().getFlash().setKeepMessages(true) before returning the redirect as a result from my action method.
All works fine, however, if I keep redirect-after-posting through my application, these messages never disappear. I have to manually clear them before issuing another redirect as in:
    private static void removeRenderedMessages(FacesContext ctx) {
        final Iterator<FacesMessage> msgIterator = ctx.getMessages();
        while (msgIterator.hasNext()) {
            if (msgIterator.next().isRendered()) {
                msgIterator.remove();
    }Is this a bug or a feature (I'm using Mojarra 2.0.2 in Glassfish 3 web profile)? I was under the impression that variables in flash scope survive for exactly one request.
Cheers,
Daniel
[www.flexive.org|http://www.flexive.org]
[1] [http://en.wikipedia.org/wiki/Post/Redirect/Get|http://en.wikipedia.org/wiki/Post/Redirect/Get]

Similar Messages

  • Redirecting after posting not working

    I noticed yesterday that if I post in a topic, I get to the page saying that I will be redirected back to the topic, but this redirection does not happen. It used to work but it seems to take ages now... I waited a few minutes to be sure, but no redirection...
    Is this a known problem or is it something at my end? I don't find anything in the bug tracker or the forum. I'm using firefox from core (3.6.8).
    Last edited by Ramses de Norre (2010-08-16 09:23:33)

    You can tell Firefox not to redirect by default or to warn you if a page wants to redirect you. There should be a link to click if auto-redirect fails.
    Edit: I just posted, Firefox warned me, I allowed redirection - and I'm being succesfully redirected.
    I could've clicked the link that starts with "Click here (...)"
    Post entered. Redirecting …
    Click here if you do not want to wait any longer (or if your browser does not automatically forward you)
    Last edited by karol (2010-08-16 10:58:36)

  • Staying on the edit page after posting

    There's something that I can't get to work and probably is not difficult at all.
    I want users to stay on the editpage after posting the form.
    I thought to do it in the processEdit method.
    By creating an url and give this as a return value. But I keep comming back to the default portal page.
    My users can go to the edit page of a channel. On the editpage I have made a telephonebook in which the users can search.
    The intention is that the users see their results on the edit page and they can select some of the results.
    my code (which doesn't work):
    String url = request.getRequestedURL().toString();
    URL editpageURL = new URL(url);
    return editpageURL;

    I use the following piece of code to display error messages on the edit pages and to redirect to the user back to the same edit screen. It has been working for me for quite a while.
    desktopUrl = context.getDesktopURL(request);
    containerName = request.getParameter("containerName");
    provider = request.getParameter("editChannelName");
    targetprovider = request.getParameter("provider");
    if (log.isDebugEnabled()) {
    log.debug("desktopUrl: "+context.getDesktopURL(request));
    log.debug("containerName: "+containerName);
    log.debug("provider: "+ provider);
    log.debug("targetprovider: "+ targetprovider);
    log.debug("errorMessage: "+ errorMessage);
    url = new StringBuffer();
    url.append(desktopUrl);
    url.append("?action=edit");
    url.append("&provider="+provider);
    url.append("&targetprovider="+targetprovider);
    url.append("&containerName="+containerName);
    if (errorMessage != null) url.append("&error="+URLEncoder.encode(errorMessage));
    if (log.isDebugEnabled()) log.debug("errorUrl: "+ url.toString());
    url = new StringBuffer(context.encodeURL(url.toString()));
    errorUrl = new URL(url.toString());
    return errorUrl;

  • Uwc redirect w/ POST /uwc/wabp/login.wabp  cmd & uwcauth.admins=calmaster

    We enabled uwcauth.admins and restarted the web container in SCS6U1. Now instead of getting proxyauth being disallowed we get redirected after a successful proxy authentication. The web client fails because of this redirection instead of accessing the wabp functions. Proxyauth appears to work with iwc/svc and it doesn't redirect us but we're not sure if NotifyLink is compatible with iwc as it also doesn't work. When the redirection takes place we aren't sent to a new hostname or port. It strips the path and redirects to /uwc for the same hostname and port we initially connected to. We are not using SSO and it doesn't seem to matter what the uwcauth.ssl.enabled paramter is active or whether we use SSL to access the site. Why is this redirection happening and what if anything can we change to stop it?
    POST /uwc/wabp/login.wabp HTTP/1.1
    Content-Type: application/x-www-form-urlencoded
    User-Agent: NotifyLink Enterprise Server
    Host: servername.domain
    Content-Length: 71
    Connection: Keep-Alive
    &username=calmaster&password=password&authOnly=true&proxyauth=username
    HTTP/1.1 302 Moved Temporarily
    X-Powered-By: Servlet/2.5
    Server: Sun Java System Application Server 9.1_02
    Set-Cookie: JSESSIONID=b923cd21e6b1c033b10ed679d4bc; Path=/uwc
    Cache-Control: private
    Location: http://servername.domain/uwc/
    Content-Type: text/html; charset=iso-8859-1
    Content-Length: 0
    Date: Thu, 07 May 2009 14:55:17 GMT
    GET /uwc/ HTTP/1.1
    User-Agent: NotifyLink Enterprise Server
    Host: servername.domain
    Connection: Keep-Alive
    Cookie: JSESSIONID=b923cd21e6b1c033b10ed679d4bc
    HTTP/1.1 200 OK
    X-Powered-By: JSP/2.1
    Server: Sun Java System Application Server 9.1_02
    Content-Type: text/html;charset=ISO-8859-1
    Content-Length: 54
    Date: Thu, 07 May 2009 14:55:17 GMT

    We tried looking at the uwc log file and I saw a Stack trace at one point but couldn't really determine anything from it. I found a workaround that works for me, but I consider it somewhat of a hack. It doesn't seem like I should need to do this, yet it makes it closer to a 'single host install' demo config. I encountered the problem because I am always trying to minimize the complexity of any installs I do by trimming out support for things which I do not want or need. We do not use the mail server portion of SCS6 thus long ago I removed most of the mail software components and support for mail (except for smtp event reminders to another mail host) and setup the domain and users with only -S cal (not mail or im). Since wabp logins work fine in iwc but iwc isn't compatible with NotifyLink (yet?), we couldn't use that, and it hints to me that uwc is more strict about the domain/users setup.
    All of these steps are required (modify usernames, passwords, domains as necessary to match your needs)
    Add mail service to the domain: (I doubt the mail hostname needs to be correct if we don't use mail, but it is required to be listed)
    /opt/sun/comms/da/bin/commadmin domain modify -D admin -w adminpass -n domain.name -d domain.name -S mail -H
    mailhost.for.domain.name
    Then for every user that needs proxy auth to work with wabp through uwc:
    /opt/sun/comms/da/bin/commadmin user modify -D admin -n domain.name -w adminpass -l username -S mail
    Redeploy uwc with mail support, bogus server values for the mail portion is okay since we wont use it, ignore the can't connect to mail server warning since its bogus anyway.
    Remember to re-enable proxy auth in /var/opt/sun/comms/ce/WEB-INF/config/uwcauth.properties
    and any other uwc settings that got wiped out by the re-deploy.
    Restart the application container server.
    I noticed another thread mentioning this one, so I will mention this post over there.

  • After installing NI Scope 3.5 RS232 in my application is very slow!

    I am using NI5114 Digitizer. After installing NI Scope 3.5 RS232 in my application is very slow. Un-installing Scope driver doesn’t help. Serial communication from my application (developed in CVI) is permanently crippled. The only fix is re-installing Windows. It happened on three different computers. I am stuck with this problem. Please help
    Richard

     Hi Richard,
     I'm very curious about where you received your NI-Scope v3.5 from, the latest version currently available is v3.4, this can be found here.
     NI-Scope does install NI-VISA, which will affect your serial ports in Labview.
     What version of NI-Scope does MAX show?
     What version of NI-Visa does MAX show?
     You could try un-installing both of those drivers then re-installing the NI-Scope v3.4 driver.
     Please do post back the results of checking the version installed of NI-Scope and NI-Visa.
     Best regards,
     MatthewW
     Applications Engineer
     National Instruments

  • How to redirect after task approved?

    Hi All,
    I tried to redirect after task approved/reject like:
    %Current Task:Form_URN%]&Source=http://sharepoint/sitename
    This technique is working in dev site but not in production. Its redirects to task list only. Is there any other work around for this issue?
    Thanks in advance!

    Hi,
    According to your post, my understanding is that you wanted to redirect after task approved.
    In order to solve the problem more efficiently, can you descript more detail that how you create the workflow and where you add the action you mentioned?
    In addition, please refer to the official article related, hope you could find something useful from it:
    http://msdn.microsoft.com/en-us/library/ms772417.aspx
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • Alert after posting in forum (and other things)

    Where do I get rid of that js alert that says 'item successfully added' or something after posting to a forum? It's obtrusive and forces an unnecessary extra click for the user.
    Also I just discovered it's entirely possible to register with a bogus email account (i did so with something along the lines of 'alskdja@'.) Since email is a required field, I think at the very least the email filter should make sure the address is valid.

    litemotiv wrote:Since you're getting errors when booting up, it might be a good idea to look in /var/log/kernel.log and /var/log/messages.log first. Just scan for obvious errors. If you are in doubt, you can pastebin them for others to look through.
    It's possible I guess... If I can find a way to cat the entire var/log to a text file and then mv it to a flash drive, it could work, but I'm not sure how to do that strictly from the command line. I have no wifi-access at all from my laptop.

  • Cant boot pc after Bios Flash

    I finally got my K7N2 mobo working so i decided to flash the bios to get rid of those faulty temps. the flas was sucessful and it restarted but now it wont boot up ive tryed everything i can think of and still nothing any ideas?

    Kagato,
    I have the K7N2, flashed the bios to the latest the other day looking for the temp detection fix. And basically mine did the same thing and I believe it is some sort of weird ram problem. It took a good 3 hrs to get mine to boot after the flash, although, I have to say i think it was booting some of the times, just no video signal. Then sometimes when I hit the power button, it would seem to get power for a split second then none. Eventually, after many attempts, (finally got it going by hitting the reset button until it booted with video signal) it booted and the temp had dropped 20 C!!! The machine ran fine but just try to reboot it, lol. I was running 512mb of generic 333 ddr (single stick), last night I added a second stick to the second channel and presto, boots fine! Weird problems! Also, with the single stick in, I had to run the ram by spd, after adding the second stick, I cranked the ram settings up in the cmos and it works great.
    I will also mention that I run a 2100+ in it @ 2700+ by setting the fsb to 166 and the vcore to 1.625.
    Good Luck, Brewer
    MSI K7N2
    XP 2100+ @ 2700+
    1gb pc2700 generic
    80gb WD JB 8mb Cache
    30 gb ata133 Maxtor
    ATI Radeon AIW 9700 Pro
    Optical Sound Riser
    LG cdrw/dvd combo drive
    Enermax 450 watt power supply
    Quote
    Originally posted by Kagato
    I finally got my K7N2 mobo working so i decided to flash the bios to get rid of those faulty temps. the flas was sucessful and it restarted but now it wont boot up ive tryed everything i can think of and still nothing any ideas?

  • NEO4 Plat Sli SIL3231 Raid problem - Can't boot after BIOS Flash!

    Hi, I have and Neo4 Platinum SLI. I had "the problem" a while back with the nVida raid where there was a hang on shutdown. I then created a RAID0 using my two Rators on the SIL3132 controller, and have three hitachi drives hooked up to SATA1 - SATA3. Back then, I had trouble getting my SIL3132 array to be the main boot volume. I could boot when no other drives were attached, but as soon as I attached them, I get the boot disk error after post. Somehow I got it to work, but not think this time, I flashed the BIOS and ran into the same problems, as the BIOS got reset.
    First, I went in and re-enabled RAID on the sil3132 controller, and change the boot order to have the RAID voluime be the first boot device, and my other drivers be the next on down the line. Upon rebooting, my system hangs after verifying DMI pool at a blanksscreen for 5 - 10 minutes then gives my the "missing HAL.dll error". if I go back into the BIOS and disable SATA1/SATA2 and SATA3/SATA4 my computer boots just fine. I even completley disconnected my three drives an my system boots just fine. I have searched these forums and could not find anything close to my issue and wondered if it is something I am just missing in the setup. I will say that at POST my IDE devices has always read:
    IDE Primary Master [None]
    IDE Secondary Master [None]
    IDE Primary Slave (my first DVD/R drive)
    IDE Secondary Slave (My second DVD/R drive)
    IDE Third Master (a 250gb drive)
    IDE Fourth Master (a 250gb drive)
    IDE Fifth Master (a 250gb drive)
    IDE Sixth Master [None]
    Is this normal? all my hard drives are SATA. the raptors and three SATAII drives.
    Any help would be greatly appreciated. Since the Nvida raid problem seems to have been fixed (as far as I read) I would like to go back to using the nVidia raid controller. I just need to back up my system first!
    Thanks in advance.

    Jkmet,
    I have noted the same problem, with a USB Pen drive.
    If I leave it plugged in and shut down, the next time I cold boot it tries to boot for the pen drive.  What I found out the any time you add a drive before booting the BIOS places it at the top of the Hard Drive Priority list making it the boot drive.  Same thing happens when I plug in a new SATA and does not mater where it is connected.  So, what I have to do any time you add a drive with the power off you have to boot to BIOS reset the Hard drive priority list, then save, exit and reboot to boot from you windows drive.
    I am sure this is a BIOS Bug, but MSI states that the way it should would work.
    Roger
    When submitting a problem, include a complete list of your system components; include part numbers, all Power Supply Voltages, and their output ratings.  It is almost impossible to estimate what your problem is without knowing something about it. Here is the link to the web site.

  • "BIOS Expand" after POST, G31TM-P21

    I installed a second-hand Adaptec AHA-2940 /2940U PCI SCSI-2 Adapter. Right after POST, I get a "BIOS Expand" message and the boot halts. According to Adaptec's site:
    "This error usually indicates that the motherboard BIOS is incompatible with the Adaptec RAID controller BIOS. Please contact the motherboard manufacturer for the latest Motherboard Flash BIOS update."
    I haven't tried the latest BIOS update. I'm mostly curious to know if this was ever addressed in an update or if this board can support a SCSI controller card. Yes, I know it's an ancient controller. Has anyone had luck with a newer one?
    This is an MSI G31TM-P21 board. MS-7529 Ver. 1.6.

     That is something you would need to contact MSI about, there's nothing we can do about BIOS hardware support here.
           >> How to contact MSI <<

  • PT880 Neo LSR - Black screen at boot up after post

    Hi all  
    I've been reading the forum for some time now and unfortunately haven't been able to fix my problem.
    Right after post I have a delay of 30 sec. before XP starts loading, the screen being black meantime.
    Just changed my PSU for a better quality one (cf. below) but this doesn't solve the issue.
    Also desabled the boot rom options, SATA and LAN under bios to no effect.
    Please also note that the GPU has a VGA and DVI outputs but the display only a VGA input. Therefore the display is connected to the VGA output of the GPU.
    Any idea will be welcome  
    Thx in advance for your help

    Hey SeekerF.  I have the same MoBo that you have.  I had problems with it also.  I really believe that it is your BIOS.  When my computer would boot into windows, or sometimes right after you see the window xp logo, it would reboot.  I switched out my PSU but that didn't work.  I had version 1.2 of the BIOS, and had to upgrade to the latest version which is 1.4.  Your best bet is to download the latest version (from someone else's machine of course from the MSI website for you board) and save the files to a floppy.  Make sure you read the instructions very carefully when you are flashing the BIOS.  When you do this you WILL need a windows 98 or ME startup floppy.  If you can't get your hands on one you can go to http://www.bootdisk.com and you can the files from there to make one.  Once you boot up your machine with the startup disk, just follow the instructions on how the flash to the latest version.  Ever since I upgraded to 1.4 I have not had any problems and my system has been stable.  Hope this helps.  Later.

  • STO - Excise tab not getting displayed in material document after posting.

    Dear all,
    We are facing an STO issue where in after we have done the receipt at the receiving plant with excise, the excise tab does not display in the GR material document.
    It is plant to plant stock transfer with excise, the process that we are following as given below:
    1) STO PO - ME21N
    2) Outbound delivery - VL10B - Post PGI in VL02N
    3) Outgoing excise invoice - J1IIN  - With the key DLFC.
    4) GR - MIGO with excise invoice capture.
    During GR posting in MIGO screen the system does display the excise tab, we enter the outgoing excise number and the corresponding values appear in BED, ECS and HCES. We post the GR material document.
    But after posting the material document if we display the same GR material document it does not show the excise invoice tab. And since we are not having part 1 entry number we are not able to post the part 2 entry in J1IEX.
    Request to please do let us know if we have missed out on any configuration or master data.
    Regards,
    mahesh.

    Hi,
    Do the all customization setting for CIN for reference check the following link for India. and Material management
    http://help.sap.com/bp_bblibrary/600/BBlibrary_start.htm
    You have to maintain Excise master data for material,vendor and PLant in J1ID .
    reward if helpful,

  • Exchange rate in header of acc.doc after posting return to vendor

    Hi Gurus,
    in accounting document, when i recalculated amount in doc.currency & amount in local currency in item line was not same with exchange rate in header section...Anyone can explain to me why this miscalculation can happen ?
    Thanks

    Hi Zafar,
    exchange rate in header of this acc.doc was take automatically from table OB08 & the problem is in item line this acc.doc which is generated automatically after posting return to vendor the calculation amount in local currency was not take the exchange rate from header but from exchange rate when GR ( FLow : mvt 101--> mvt 122 ). so this is normal behaviour or there are bug ?
    thanks in advance

  • Delivery document creation after Posting of Goods through Purchase Order

    Dear All,
    Could you please help me out by letting me know how to create a delivery document flow i.e. entry in VBFA table after Posting of Goods through PO, I have Inbound delivery document that I know & also a succssfull Material document that is created and can be viewed through Purchase order history BY USING ME23N transaction code.
    so please let me know is there any way to create a delivery by inputing delivery no., Material Doc & Material Doc year
    Thanks,
    Sanjay

    Additonally:
    At the time of GR the inbound delivery ican be updated in MIGO also if you set the suitable indicator in:
    SPRO > LE > Shipping > Basic Shipping Functions > Configure Global Shipping Data (V_TVSHP-SPE_INB_VL_MM)
    (see OSS note 1050944)
    Even though you implement this change or w/o this change post the GR in VL32N, you won't get the document flow in table VBFA.
    You can use table EKBE to get the necessary information.
    Regards,
    Csaba

  • Posting of cancelled Invoice after posting date is over

    Hello Experts,
    I am stuck up with a situation and as such seek your help.
    A invoice was generated and the subsequent accounting document was also cleared. Now after the posting date was over, someone cancelled the invoice by T.code VF11 and as expected it didnt get posted .The document flow showing is as per below :
    Order - open
    Invoice - completed
    Accounting Document - Cleared
    Cancel Invoice - Open
    Now, the business and their audit policies do not allow the client to cancel the invoice in back date ( within the posting period).
    What are the options do we have to tackle the situation.
    Joy

    The issue has been temporarily addressed by changing the posting date.
    However, now the client wants us to make an ABAP development so that no user is able to cancel the invoice after posting date is over. Now for that I have the following issues. Can someone please help me out in this.
    The basic process details I am following is as per below:
    For Transaction Code VF11 (i.e for Cancellation of Invoice) , when the invoice number which is subject to cancellation is provided, the System should search in VBRK table for the following :-
    1)The System will at first search whether the entry exists or not. If the Entry is not valid then it should give an message u201C Document xxxxx does not Existu201D.This is in line to the existing practice.
    2) If the Document number is valid then it will go to the billing date field and  will fetch the value from the VBRK table . Then it will match  whether the value fetched (i.e. this Invoice date)  is in present posting period or not. The system can find the posting period from the table V_T001B.
    a.If  the  Invoice date lies in the present posting period then the system will allow the cancellation document to be saved. This is in line to the existing process.
    b.If the Invoice date lies beyond the present posting period then the system will not allow to save the cancellation of the Invoice with a pop up message of u201C The Document number subject to cancellation do not lie within the present posting periodu201D .
    Now We have looked both the tables, from VBRK we will get Doc# and Billing date(FKDAT) but when we select Posting Date from table T001B( Permitted Posting Periods) there is some issue.
    1.  What will be the condition for selecting records from T001B table.Since there is multiple key fields
        RRCTY (Record Type) ,
        BUKRS (Posting Period Variant) ,
        MKOAR (Account Type or Masking)
        BKONT (To Account). 
    So, to get unique record what will be the value of this key fields. Is there any relationship with VBRK table ? 
    2.  Which field I have to consider as Posting Date or Period. Because there are many fields related to Posting period.

Maybe you are looking for

  • Getting video from DVD

    I have used a VCR Player/DVD recorder to transfer files from old family VHS tapes to DVD. After finalizing these DVD-R disks, I wanted to take them to my Mac and further edit them with iMovie or iDVD, however, the Mac will only play them with DVD Pla

  • Printing header list of emails in a mailbox

    Hello. I want to print a list of all emails in a mailbox. The list should embody the information of the given columns of the mailbox, for example: - sender - recipient - subject - date and time of delivery How can I get such a list? TIA and kind rega

  • Template selection (Scope)

    Hello Friends, Everytime I create a project, I get default same scenarios template underneath scope tab.  When I expand Select one or more scenarios, I get "BP_UTUS147 - Best Practices for Water Utility".It is suppose to give me list of scenarios.. r

  • Address book has triple entries on after updating to cloud. How do I fix this?

    my address book in my phone has triple entered all addresses after I have joined the cloud with the new 4s iphone. How do I fix this?

  • File Description in Planner Profile

    Hello All I am facing similar issue which few others have faced , linking File Description to Planner profile & using in upload file. I have linked the planner profile  Z-ALLXL , 'integrated excel' with file description COB_*  (as I intend to create