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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:16:17+00:00 2026-05-17T02:16:17+00:00

I have a h:dataTable that displays ProfileNotification like below: <h:dataTable value=#{myBean.profileNotifications} var=item rendered=#{myBean.renderProfileNotification}> <h:column>

  • 0

I have a h:dataTable that displays ProfileNotification like below:

        <h:dataTable value="#{myBean.profileNotifications}" var="item"
                     rendered="#{myBean.renderProfileNotification}">
            <h:column>
                <h:form>                        
                    <h:outputText value="#{item.userName} "/>
                    <h:outputText value="commented on your profile. "/>
                    <!-- <h:outputText value="[#{item.createTime}]"/> -->
                </h:form>
            </h:column>                
        </h:dataTable>

when I dont have the item.createTime, if I click a commandLink to set renderProfileNotification=true, it print out 4 items. However, if i uncommented item.createTime, the it only print out 1 item, the first item.

EDIT: The problem is the [] inside value. Since BalusC suspect that this is an EL bug, I reproduce my bug in a small, readable and reproducible code. This code run on Glassfish v3.0.1 b22

index.xhtml

<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:p="http://primefaces.prime.com.tr/ui">
<h:head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>TODO supply a title</title>
</h:head>
<h:body>
    <h:form id="table">
        <h:dataTable   value="#{myBean.temp}" var="item" rendered="#{myBean.display}">
            <h:column>
                <h:outputText value="[#{item}]"/>
            </h:column>
        </h:dataTable>            
    </h:form>
    <h:form>
        <p:commandLink value="Display" actionListener="#{myBean.setDisplay}" update="table"/>
    </h:form>
</h:body>
</html>

myBean.java

@ManagedBean(name="myBean")
@SessionScoped
public class myBean {

List<String> temp = null;

public myBean() {
}

private boolean display = false;

@PostConstruct
public void init(){
    temp = new ArrayList<String>();
    temp.add(0, "Tom");
    temp.add(1, "Peter");
    temp.add(2, "Mike");
    temp.add(3, "Fox");
}

public List<String> getTemp() {
    return temp;
}

public void setTemp(List<String> temp) {
    this.temp = temp;
}

public boolean isDisplay() {
    return display;
}

public void setDisplay() {
    this.display = !this.display;
}
}
  • 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-17T02:16:18+00:00Added an answer on May 17, 2026 at 2:16 am

    OK, it’s the last ] which is causing problems. When using

    <h:outputText value="[#{item}]"/>
    

    the XML response of the ajax request is as follows:

    <?xml version="1.0" encoding="UTF-8"?><partialResponse><components><component><id>table</id><output><![CDATA[
    <form id="table" name="table" method="post" action="/playground/test.jsf" enctype="application/x-www-form-urlencoded">
    <input type="hidden" name="table" value="table" />
    <table>
    <tbody>
    <tr>
    <td>[Tom]]]><![CDATA[</td>
    </tr>
    <tr>
    <td>[Peter]]]><![CDATA[</td>
    </tr>
    <tr>
    <td>[Mike]]]><![CDATA[</td>
    </tr>
    <tr>
    <td>[Fox]]]><![CDATA[</td>
    </tr>
    </tbody>
    </table>
    ~com.sun.faces.saveStateFieldMarker~
    </form>]]></output></component></components><state><![CDATA[<input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="8834103461195979522:5904029216967015556" autocomplete="off" />]]></state><callbackParams><callbackParam>{"validationFailed":false}</callbackParam></callbackParams></partialResponse>
    

    Note the unnecessary CDATA blocks.

    And when using

    <h:outputText value="[#{item})"/>
    

    the XML response of the ajax request is as follows:

    <?xml version="1.0" encoding="UTF-8"?><partialResponse><components><component><id>table</id><output><![CDATA[
    <form id="table" name="table" method="post" action="/playground/test.jsf" enctype="application/x-www-form-urlencoded">
    <input type="hidden" name="table" value="table" />
    <table>
    <tbody>
    <tr>
    <td>[Tom)</td>
    </tr>
    <tr>
    <td>[Peter)</td>
    </tr>
    <tr>
    <td>[Mike)</td>
    </tr>
    <tr>
    <td>[Fox)</td>
    </tr>
    </tbody>
    </table>
    ~com.sun.faces.saveStateFieldMarker~
    </form>]]></output></component></components><state><![CDATA[<input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="502405171373727621:5591448575905434431" autocomplete="off" />]]></state><callbackParams><callbackParam>{"validationFailed":false}</callbackParam></callbackParams></partialResponse>
    

    This boils down to the following problem cause: the ajax response handler is unnecessary closing and starting a CDATA block for a ] in partial response and the JS XML response parser only picks the first one for display. An easy workaround was to place the ] outside the value expression:

    <h:outputText value="[#{item}"/>]
    

    which results in the following XML response:

    <?xml version="1.0" encoding="UTF-8"?><partialResponse><components><component><id>table</id><output><![CDATA[
    <form id="table" name="table" method="post" action="/playground/test.jsf" enctype="application/x-www-form-urlencoded">
    <input type="hidden" name="table" value="table" />
    <table>
    <tbody>
    <tr>
    <td>[Tom]
                </td>
    </tr>
    <tr>
    <td>[Peter]
                </td>
    </tr>
    <tr>
    <td>[Mike]
                </td>
    </tr>
    <tr>
    <td>[Fox]
                </td>
    </tr>
    </tbody>
    </table>
    ~com.sun.faces.saveStateFieldMarker~
    </form>]]></output></component></components><state><![CDATA[<input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="-1679996061683473780:1967669133311943592" autocomplete="off" />]]></state><callbackParams><callbackParam>{"validationFailed":false}</callbackParam></callbackParams></partialResponse>
    

    I am not sure yet where the problem is rooted, in the ajax response handler or in the JS XML response parser, but now we at least know the cause. I will report an issue to the Mojarra guys sooner or later once nailed down.


    Update: OK, I nailed it further down: it’s the PrimeFaces’ ajax response handler and JS XML parser which doing this incorrectly. When using a Mojarra’s h:commandLink instead of p:commandLink it works fine.

    <h:commandLink value="Display" actionListener="#{myBean.setDisplay}">
        <f:ajax render=":table" />
    </h:commandLink>
    

    Mojarra’s ajax response handler doesn’t print unnecessary CDATA blocks after each ]. That might be the root cause in PrimeFaces.


    Update: issue reported to PF guys: http://code.google.com/p/primefaces/issues/detail?id=1282

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

Sidebar

Related Questions

I have a project that adds elements to an AutoCad drawing. I noticed that
I have a script that appends some rows to a table. One of the
I have a new web app that is packaged as a WAR as part
I have a snippet to create a 'Like' button for our news site: <iframe
I have found this example on StackOverflow: var people = new List<Person> { new
I have several USB mass storage flash drives connected to a Ubuntu Linux computer
I have a login.jsp page which contains a login form. Once logged in the
i have a input tag which is non editable, but some times i need
Let say I have the following desire, to simplify the IConvertible's to allow me
I want to have generalised email templates. Currently I have multiple email templates with

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.