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 9144411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:15:48+00:00 2026-06-17T10:15:48+00:00

Why does context.redirectToPage behave differently when executed in a view root-event instead of an

  • 0

Why does context.redirectToPage behave differently when executed in a view root-event instead of an event handler?

This question came up when I tried to set the language of an xpages application to the language saved in the user profile, once the user is logged in. I use a properties-file with translated strings in a resource bundle, and retrieve the strings like this:

<xp:text value="${langString['WELCOME_TEXT']}" />

When the language is changed and so a different properties-file is loaded, the page needs to be refreshed in order to update those strings. This worked fine when I added a full-refresh event handler to the login button, that executed a server side context.redirectToPage(). No luck with client side refreshes like location.reload or window.location.href=window.location.href (the login-function itself is a client side function though).

But of course the user expects that he is also logged in when he presses the enter key instead of the button after he has entered his credentials. So I added an onkeypress-event to the username and password input fields, and checked for the enter key (if (thisEvent.keyCode==13) dosomething…) before executing the login function.

But now the event handler is called every time a key is pressed and of course I do not want the context.redirectToPage to be executed all the time.
Thus I removed the server side event handlers and changed the login function so that it terminated with a partial refresh of the div containing the whole page:

var p = {"execLogin":"true"}; XSP.partialRefreshPost( '#{id:wholePage}', {params: p} );

The parameter sent via the partial refresh now triggers an event in which our context.redirectToPage is executed:

<xp:this.beforeRenderResponse><![CDATA[#{javascript:if (param.containsKey('execLogin') && param.get('execLogin').toString().equals('true')) {
    print("test");
    context.redirectToPage(context.getUrl().toSiteRelativeString(context),true);
}}]]></xp:this.beforeRenderResponse>

The page is refreshed and “test” is printed out, but I still see the old language strings. I have to refresh the page manually again to make the new user language take effect.

Any idea how to execute a genuine full refresh this way, or maybe another way to update the strings retrieved from the property bundle?

Thanks in advance. Regards,
Sarah

EDIT

I now have:

<xp:inputText id="cc_login_panel_login_username" styleClass="span2">
<xp:eventHandler event="onkeypress" submit="true" refreshMode="complete">
    <xp:this.script><![CDATA[if (thisEvent.keyCode!=13) {
        return false;
    } else {
        doLogin();
        return true;                                
    }]]></xp:this.script>
    <xp:this.action><![CDATA[#{javascript:context.redirectToPage(context.getUrl().toSiteRelativeString(context));}]]></xp:this.action>
</xp:eventHandler>

Because context.reloadPage() didn’t even log me in somehow (strange) I got back to using redirectToPage. The server side event is fired once and at the right time *thumbs up*, but the language properties-bevaviour is still the same.

  • 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-17T10:15:49+00:00Added an answer on June 17, 2026 at 10:15 am

    $ is only set on page load, whereas # is set each time during the partial refresh.

    I don’t think a partial refresh will work at all though. This will refresh the computed field. However, it will need a full refresh to refresh the part of the XPage that includes the properties file. In other words, you would be refreshing the computed field, but using the same properties file.

    I wonder if context.redirectToPage or context.reloadPage is somehow going to the same page but with the cached properties files.

    If you’re always wanting to come back to the same page, a full refresh instead of partial refresh may be the best option.

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

Sidebar

Related Questions

This is a very general question, and I think my context does not matter
What does this expression mean: .-main in context of: .size main, .-main ?
<xsl: when test=not(descendant::*[SomeAttribute])> Does this mean to check if a context node does NOT
Quick question about EJB 3 stateless bean jndi lookup from context. Does context.lookup(myBean) return
WebBrowser context menu or custom context menu does not shown over combobox. How to
I have a function called PreProcessSource, which allocates a boost::wave::context and does some preprocessing;
Does the Grand Central Dispatch API allow an execution context (thread) to query any
in google's bigtable context, what does a commit log mean? and what is the
It does not appear in the UTI Image Content Types. Also, if this is
Apologies in advance for the length of this question! I have a data structure

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.