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

  • SEARCH
  • Home
  • 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 6327587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:18:23+00:00 2026-05-24T17:18:23+00:00

I have a JSF 2.0 web application running on glassfish 3.1 that is working

  • 0

I have a JSF 2.0 web application running on glassfish 3.1 that is working fine on IE, FF, Safari and Chrome.

When I added the url of my website inside a iframe of another website then I am getting ViewExpiredException after clicking any button inside iframe – This happens only on Safari, works fine in IE, FF, Chrome.

<iframe style="width: 100%; height: 800px" src="url_of_my_website" frameBorder="0"></iframe>

Following are my observations

  1. Deployed the same application on glassfish 3.0.1 and the problem doesn’t happen
  2. If I open my website without frame, it works fine irrespective of browser
  3. Developed the same application using JSF1.2 and RF 3.3.3 and the problem doesn’t happen

As per my understanding, we get ViewExpiredException when any action is performed on a page whose session is expired. But in this particular case it happens just after the website gets load loaded.

I’m not sure about what’s causing it. Is it Safari/JSF 2.0/GF 3.1/IFRAME?

Update:
I found an interesting problem. On my home page, I have a h:commandLink that redirects me to a new page. Also, I have a href link to redirect to some other page. When I click on the commandLink, I’m getting ViewExpiredException but when I click on href link, I’m not getting any exceptions and the page is redirected and I can proceed with further operations as session cookie is getting established.

  • 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-05-24T17:18:23+00:00Added an answer on May 24, 2026 at 5:18 pm

    This is indeed a known problem. Safari does not allow crossdomain cookies. Any cookies delivered by an iframe will just be ignored by this browser. The HTTP session is backed by a cookie. So it won’t be maintained as well. Thus, when you submit a JSF form inside an iframe, then Safari won’t send the session cookie back and the server side will implicitly create a new session and thus the view which was set in the initial session is completely lost. Hence the ViewExpiredException.

    In theory, this can be solved to include the JSESSIONID fragment in the action URL of the JSF-generated HTML <form> element. E.g.

    <form action="/context/page.xhtml;JSESSIONID=1234567890ABCDEF">
    

    However, JSF already does that. It uses under the covers HttpServletResponse#encodeURL() for that. That it didn’t work for you on JSF 2 while it apparently worked on JSF 1.2 is for me a mystery. But you have now at least something to concentrate on. Did HttpServletResponse#encodeURL() return the properly encoded URL with JSESSIONID inside? Does the generated HTML <form> include the JSESSIONID? Etc. When using Mojarra, start with FormRenderer#getActionStr() method while debugging.

    Anyway, another solution is to use JavaScript for this. Do something like the following during onload of the JSF page which is to be displayed inside an iframe. The following script kickoff example should be embedded inside the JSF page so that #{} will be evaluated.

    window.onload = function() {
        if (top != self) { // If true, then page is been requested inside an iframe.
            var jsessionid = '#{session.id}';
            var forms = document.forms;
    
            for (var i = 0; i < forms.length; i++) {
                forms[i].action += ';JSESSIONID=' + jsessionid;
            }
        }
    }
    

    This should not harm browsers other than Safari.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Java-JSF Web Application on GlassFish, in which I want to use
We have JSF web application that generates XLS file and gives user link to
I have developed a java web application using JSF 2.0(Facelets) on GlassFish 3.1.1 with
I'm working on a JSF 2 web application. If I define a facelet that
We have a JSF web application that uses Acegi security. We also have a
I have connecting to my database in a JSF web application that I am
I have a Tomcat 6 JSF web application that I'd like to set up
i have a JSF web application. I use Beans as Spring Beans (not JSF
I have a JSF web client and a Java client that both use the
I have a JSF application that uses mostly Richfaces. I would like to introduce

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.