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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:21:28+00:00 2026-06-17T16:21:28+00:00

Related to my JSF application, I noticed there’s a problem with the Mojarra JSF

  • 0

Related to my JSF application, I noticed there’s a problem with the Mojarra JSF 2.1.16 library. I have a ViewScoped bean which loads a user from a login got as ViewParam. After that loaded user data can be managed and saved. Below is the view code, where I have skiped the main form fields as I have tested there’s no problem with them.

    <ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:p="http://primefaces.org/ui"
template="/templates/general_template.xhtml">

<ui:define name="metadata">
    <f:metadata>
        <f:viewParam id="user" name="user"
            value="#{manager._ParamUser}" />
        <f:event type="preRenderView"
            listener="#{manager.initialize}" />
    </f:metadata>
</ui:define>

<ui:define name="general_content">
    <p:outputPanel autoUpdate="false" id="loggedData" name="loggedData"
        layout="block">
        <h:form id="SystemUserForm">

            <h:panelGrid columns="4" cellspacing="10px" style="border-color:red;">
                <h:outputText value="#{msg.LOGIN}:" />
                <h:outputText value="#{manager._UserBean._login}" />
            </h:panelGrid>
            <p:commandButton value="#{msg.UPDATE}" action="#{manager.actionSave}"
    ajax="false" />

            <p:commandButton value="#{msg.CANCEL}"
    action="#{manager.actionCancelSave}" ajax="false" />
        </h:form>
    </p:outputPanel>
</ui:define>

At the beginning bean is created and User itself is loaded from data base using received param. Problem comes when I call the action method to save it, because the ViewScoped bean called manager is being constructed again. So there’s no param and I have a null pointer Exception. That’s working properly with Mojarra 2.1.14 and 2.1.15.

Backing bean code:

@ManagedBean
@ViewScoped
public class Manager extends UserData {

public static final String PARAM_USER = "ParamUser";

private String _ParamUser;

public String get_ParamUser() {
    return this._ParamUser;
}

public void set_ParamUser(String _ParamUser) {
    this._ParamUser = _ParamUser;
}

public Manager() {
    super();
}

@Override
public void initialize(ComponentSystemEvent event) {
    if (!FacesContext.getCurrentInstance().isPostback()) {
        loadUserBean(this._ParamUser);
        if (this._UserBean == null) {
            redirectTo404();
        }
    }
}

@Override
public String actionSave() {
    super.actionSave();
    return NavigationResults.USER_LIST;
}

UserData is, of course, an abstract class. When actionSave() is called bean is constructed again and there is no _ParamUser attribute, because this is get by viewParam. That constructor recall is only happening with Mojarra 2.1.6.

  • 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-17T16:21:29+00:00Added an answer on June 17, 2026 at 4:21 pm

    This issue has been solved in Mojarra JSF 2.1.17, tried and tested. Could be a problem with Mojarra JSF 2.1.16 and Tomcat 6. However, I haven’t found any known issues for that version.

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

Sidebar

Related Questions

I have two web application projects which are related. One is the website itself
I have a problem related to JSF 2 . I'm using the 2.1.4 version
Related to a question I asked earlier here , I've found a problem which
I have a view-scoped JSF-managed bean that's backing an xhtml view where I read
i have a jsf application running on tomcat 6.0 and somewhere in the app
I have a JSF 1.2 application (Sun RI, Facelets, Richfaces) that was used only
I m creating an app using JSF. The problem I have is that every
In my JSF 2 based application I have a form that includes (amongst other
I'm trying to better understand the low-level workings of a @ViewScoped bean in JSF
I'm running in a little issue here regarding jsf related dropdown selection. I have

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.