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

The Archive Base Latest Questions

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

I have a masterLasyout.xhtml : <h:form id=abc> <h1> <ui:insert id=abc1 name=title></ui:insert> </h1> <p> <ui:insert

  • 0

I have a masterLasyout.xhtml:

<h:form id="abc">
  <h1>
    <ui:insert id="abc1" name="title"></ui:insert>
  </h1>
  <p>
    <ui:insert id="abc2" name="body"></ui:insert>
  </p>
</h:form>

I have 2 snippets files (they are inside ui:composition):

<p:inputText id="it1" value="#{exampleBean.name}" immediate="true" ></p:inputText>
<h:commandLink id="cl1" immediate="true"  value="Text1" action="#{exampleBean.ModifyLink2}" actionListener="exampleBean.Modify">
    <p:ajax update=":abc:main"></p:ajax>
</h:commandLink>

second file:

<p:inputText id="it2" value="#{exampleBean.name}" immediate="true"></p:inputText>
<h:commandLink id="cl2" immediate="true" value="Text2" action="#{exampleBean.ModifyLink}" actionListener="exampleBean.Modify"  >
    <f:param value="/snippets/snippet1.xhtml" id="link"></f:param>
    <p:ajax update=":abc:main"></p:ajax>
</h:commandLink>

I have the managed bean:

Now, I wish to switch between the snippets, and between fire an action in the following managed bean:

@ManagedBean (name="exampleBean")
@RequestScoped
public class ExampleBean {

    /** Creates a new instance of ExampleBean */
    public ExampleBean() {
        m_User = new User();
        SnippetFileName = "/snippets/snippet2.xhtml";
    }

    public void Modify(ActionEvent a){
        System.out.println("Modify");
        ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
        String t = externalContext.getRequestParameterMap().get("link");        
        System.out.println("SnippetFileName in ModifyLink is " + t);
    }

    public String ModifyLink()
    {        
        System.out.println("ModifyLink");
        SnippetFileName = "/snippets/snippet1.xhtml";
        return "page";
    }

    public String ModifyLink2()
    {
        System.out.println("ModifyLink2");
        SnippetFileName = "/snippets/snippet2.xhtml";
        return "page";
    }

    private String SnippetFileName;

    public String getSnippetFileName()
    {
        return SnippetFileName;
    }

    public void setSnippetFileName(String i_filename)
    {
        SnippetFileName = i_filename;
    }
    private User m_User;
    public String getName(){
        System.out.println("getName");
        if (m_User==null)
        {
            return null;
        }
        return m_User.getName();
    }

    public void setName(String i_Name){
        System.out.println("setName");
        String name = i_Name.trim();
        if (m_User!=null)
        {
            m_User.setName(name);
        }
    }
}

What that is happening is that in clicks number 1,3,5,7… the ModifyLink method fires, and in clicks number 2,4,6,8… `ModifyLink2′ doesn’t. I can’t seem to understand why this behavoiur happens.
I read few articles, including commandButton/commandLink/ajax action/listener method not invoked or input value not updated that states 7 issues that none of them fits in the spoken case and http://vierwaende.org/articles/posts/jsf-2-evaluation-test.html which brings about a very good overview on JSF 2 lifecycles.
I have also tried to remove Ajax, and it still does the same.

Thanks in advance.

  • 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-23T15:24:22+00:00Added an answer on May 23, 2026 at 3:24 pm

    Problem is fixed. In web.xml I defined:

     <context-param>
         <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
         <param-value>false</param-value>
     </context-param>
    

    I wonder whether there is a possibility to add dynamically (programatically or using xml files) in JSF 2 workflow page controls that has to be added dyanmically. In the case of the question above, one of the controls was not defined in the control tree that is created during the first request of the page. So, in another note: is there an option to add controls dynamically to the controls tree without modifying web.xml, for optimization?

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

Sidebar

Related Questions

Have have this line of code in my form when I create a new
Have a look on following application http://itunes.apple.com/us/app/fatbooth/id372268904?mt=8 i think they are using the same
Have the following scenario. I have a few form, which essentially have a few
I have the following template (masterLayout.xhtml): <!DOCTYPE html> <html xmlns=http://www.w3.org/1999/xhtml xmlns:h=http://java.sun.com/jsf/html xmlns:ui=http://java.sun.com/jsf/facelets> <f:view contentType=text/html>
I have a tiles-defs.xml that has these definitions... <definition name=masterLayout path=/WEB-INF/tiles-layouts/globalLayout.jsp> <put name=pageTemplate value=over-ride
have such zend query: $select = $this->_table ->select() ->where('title LIKE ?', '%'.$searchWord.'%') ->where('description LIKE
Have just started using Google Chrome , and noticed in parts of our site,
Have you ever seen any of there error messages? -- SQL Server 2000 Could
Have you guys had any experiences (positive or negative) by placing your source code/solution
Have just started using Visual Studio Professional's built-in unit testing features, which as 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.