Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8981965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:27:59+00:00 2026-06-15T20:27:59+00:00

I use tip from this post https://stackoverflow.com/a/13838907 to open new tab, however when I

  • 0

I use tip from this post https://stackoverflow.com/a/13838907 to open new tab, however when I go back to old one I get nullPointerException and my ViewScoped bean data are lost.

<h:form target="_blank">
  <p:commandButton value="open new tab" action="#{otherBean.newTab}" ajax="false" />
</h:form>

<h:form>
  <p:commandButton value="this wll cause NPE" action="#{pageBean.action}"/>
</h:form>

Click first button, go back to previous tab, click second button. PageBean is created once again and all data are lost. Both beans are ViewScoped.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T20:28:00+00:00Added an answer on June 15, 2026 at 8:28 pm

    Indeed, the view scoped bean in the initial tab/window get killed by returning a String navigation case outcome. You would like to return null or void to keep it alive. Based on the newTab() code as shown in your other question, you need to replace the navigation case by a Faces#redirect() call (assuming that it’s indeed OmniFaces which you’re using there for Faces#setFlashAttribute()). You only need to set Flash#setRedirect() to true beforehand to instruct the flash scope that a redirect will occur.

    public void newTab() throws IOException {
        Faces.setFlashAttribute("foo", bar); 
        Faces.getFlash().setRedirect(true);
        Faces.redirect("otherView.xhtml");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use the django-voting tutorial from this blog: http://new.justinlilly.com/blog/2008/nov/04/django-voting-a-brief-tutorial/ to get a
I using tip from this ask stackoverflow.com/questions/12413460 It's work. My problem is the image
Few hours ago I changed from my old Debian box to a new one,
I'm trying to apply the advice in this post: Tip 22 - How to
Picking up a tip from someone else on this site, I've been using logical
I have the following situation. From an application located in https://subdomain.mydomain.com I am trying
use Text::Table; my $tb = Text::Table->new(Planet,Radius\nkm,Density\ng/cm^3); $tb->load( [ Mercury,2360,3.7], [ Mercury,2360,3.7], [ Mercury,2360,3.7], );
use LWP::UserAgent; use Data::Dumper; my $ua = new LWP::UserAgent; $ua->agent(AgentName/0.1 . $ua->agent); my $req
Whenever I use a macro in Visual Studio I get an annoying tip balloon
I have this problem: I am choosing a file from JFileChooser and if i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.