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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:51:06+00:00 2026-05-25T13:51:06+00:00

I have a h:commandLink inside rich:dataTable . When I click on the command link,

  • 0

I have a h:commandLink inside rich:dataTable. When I click on the command link, I’m adding a FacesMessage to the context and redirecting to the same message. I have a h:messages tag on the page to display any faces messages. I am able to display the message, but I’m getting following warning and the messages are not getting cleared.

WARNING: JSF1095: The response was already committed by the time we tried to set the outgoing cookie for the flash. Any values stored to the flash will not be available on the next request.

I am using JSF2.0, RF4.0.0.Final. Following is the code

index.xhtml

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:rich="http://richfaces.org/rich">
<h:head>
    <title>DataTable Test</title>
</h:head>
<h:body>
    <h:form prependId="false">
        <rich:panel header="Data table test">
            <br/><br/>
            <rich:dataTable id="dTable" value="#{myBean.allInventory}" var="inv" style="margin: auto; width: 100%; min-width: 750px;"
                            rows="10" onrowmouseover="this.style.backgroundColor='#A0A0A0'"
                            onrowmouseout="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
                <rich:column>
                    <f:facet name="header">
                        <h:outputText value="Sl No" />
                    </f:facet>
                    <h:outputText value="#{inv.slno}" />
                </rich:column>
                <rich:column>
                    <f:facet name="header">
                        <h:outputText value="Item 1" />
                    </f:facet>

                    <h:commandLink id="docMessage" title="Click for details" action="#{myBean.cLink(inv)}" value="#{inv.item1}"/>
                </rich:column>
                <rich:column>
                    <f:facet name="header">
                        <h:outputText value="Item 2" />
                    </f:facet>
                    <h:outputText value="#{inv.item2}" />
                </rich:column>
                <f:facet name="footer">
                    <rich:dataScroller id="dataScroll" for="dTable"/>
                </f:facet>
            </rich:dataTable>

            <h:messages id="messages" globalOnly="true" layout="table" ></h:messages>
        </rich:panel>
    </h:form>
</h:body>

MyBean.java

package com.mypkg;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.enterprise.context.SessionScoped;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.inject.Named;

@Named
@SessionScoped
public class MyBean implements Serializable {

private List<Inventory> allInventory = null;

/**
 * @return the allInventory
 */
public List<Inventory> getAllInventory() {
    if (allInventory == null) {
        allInventory = new ArrayList<Inventory>();
        for (int i = 0; i < 100; i++) {
            Inventory e = new Inventory();
            e.setSlno(i + 1);
            e.setItem1("Item1" + Math.random());
            e.setItem2("Item2" + Math.random());
            allInventory.add(e);
        }
    }
    return allInventory;
}

public String cLink(Inventory inv) {
    FacesContext.getCurrentInstance().getExternalContext().getFlash().setKeepMessages(true);
    FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Sample Error Message", "Sample Error Message"));
    return "index?faces-redirect=true";
}

/**
 * @param allInventory the allInventory to set
 */
public void setAllInventory(List<Inventory> allInventory) {
    this.allInventory = allInventory;
}

}

Inventory.java

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package com.mypkg;

public class Inventory {

    private int slno;
    private String item1;
    private String item2;

    /**
     * @return the slno
     */
    public int getSlno() {
        return slno;
    }

    /**
     * @param slno the slno to set
     */
    public void setSlno(int slno) {
        this.slno = slno;
    }

    /**
     * @return the item1
     */
    public String getItem1() {
        return item1;
    }

    /**
     * @param item1 the item1 to set
     */
    public void setItem1(String item1) {
        this.item1 = item1;
    }

    /**
     * @return the item2
     */
    public String getItem2() {
        return item2;
    }

    /**
     * @param item2 the item2 to set
     */
    public void setItem2(String item2) {
        this.item2 = item2;
    }


}
  • 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-25T13:51:06+00:00Added an answer on May 25, 2026 at 1:51 pm

    This problem is related to the <rich:dataScroller> which you’ve there in your table footer. When I removed it, everything works as expected.

    I checked around in RichFaces issue tracker if this bug is known, but it apparently isn’t. You may want to consider to repost a minimal example of your code as you’ve in the question (several columns, headers and attributes are unnecessary and makes code unnecessarily large, so trim them away) in a new issue report over there.

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

Sidebar

Related Questions

If you have a JSF <h:commandLink> (which uses the onclick event of an <a>
Have you ever seen any of there error messages? -- SQL Server 2000 Could
This is the command line I want to use inside my VB.NET program. Look
Have just started using Google Chrome , and noticed in parts of our site,
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
Have you used VS.NET Architect Edition's Application and System diagrams to start designing a
Have you determined a maximum number of characters allowed in FCKEditor ? I seem
Have a n-tire web application and search often times out after 30 secs. How
Have you managed to get Aptana Studio debugging to work? I tried following this,

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.