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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:57:31+00:00 2026-06-05T15:57:31+00:00

I’ve a list of messages in the backing bean which i’m using in a

  • 0

I’ve a list of messages in the backing bean which i’m using in a ui:repeat tag to display on the xhtml page.

<?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:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui" >
    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link rel="stylesheet" type="text/css" href="../Styles/homepage-style.css" />
        <link rel="stylesheet" type="text/css" href="../Styles/profile.css" />
        <title>Shadi Bandhan | We find the best match for you</title>

        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
        <script type="text/javascript">

            $(document).ready(function(){
                $("div#openMessage").hide();


            });

            function openMessage(id){
                //$("div#openMessage").slideDown(4000);
                alert(id);
            }
        </script>

    </h:head>

    <h:body>

        <div id="header">
            <ui:insert name="header" >
                <ui:include src="header.xhtml" />
            </ui:insert>
        </div>

        <div id="main-content">
            <p:growl autoUpdate="true" />

            <div id="left-pane">
                <div id="profile-info-area">

                    <div id="profile-info">

                        <span>
                            <img class="profileImg" src="../images/profileImg.jpg" width="185" height="200" />
                        </span>

                        <img class="request-btn" src="../images/request_photo_btn.jpg" height="35" width="156"/>

                        <a href="sentMessages.xhtml">Sent box</a> <br />
                        <a href="#">Drafts</a> <br />
                        <a href="#">My Packages</a> <br />
                        <a href="#">Other Settings</a> <br />
                        <a href="#">FAQs</a>
                    </div>

                </div>
                <div id="home-main-area">
                    <div id="messages-wrapper">

                        <div id="messages-header">

                            <div id="m-heading">
                                Messages - Inbox
                            </div>

                            <div id="m-search">

                                <div id="searchbox">
                                    Search Messages <input type="text" value="Search" />
                                </div>

                                <!--                                <div id="newmessage">
                                                                    <a href="#"> + New Message </a>
                                                                </div>-->

                            </div>

                        </div>

                        <h:form id="messagesForm">
                            <div id="messages">

                                <p:dialog id="messagesDialog" modal="true" widgetVar="messageDialog" resizable="false"  width="750" height="200" header="New Message" >  

                                    <h:panelGrid columns="2" id="dialogGrid">
                                        <p:column>
                                            <h:outputLabel for="msgRecepient"  value="To"/>
                                        </p:column>
                                        <p:column>
                                            <h:outputLabel id="msgRecepient" value="#{userMsg.userFullname}"  >

                                            </h:outputLabel>
                                        </p:column>
                                        <p:column>
                                            <h:outputLabel for="msgContents"  value="Message"/>
                                        </p:column>
                                        <p:column>
                                            <p:inputTextarea maxlength="300"  id="msgContents" value="#{messagesManagedBean.msg.message}" cols="65" rows="3" >
                                                <p:watermark for="msgContents" value="#{userMsg.userId}" />
                                            </p:inputTextarea>


                                        </p:column>

                                        <p:column>
                                            <p:commandButton id="msgSend" value="Send"  action="#{messagesManagedBean.sendMessage('reply')}" oncomplete="messageDialog.hide()"  >
                                                <f:param value="#{userMsg.userId}" name="messageSenderId" />
                                            </p:commandButton> 
                                        </p:column>

                                    </h:panelGrid>

                                </p:dialog>

                                <ui:repeat var="userMsg" value="#{messagesManagedBean.paginator1.model}">

                                    <center><img class="h-diff" src="../images/differentiator-profile.jpg" width="437" height="1" /></center>
                                    <div class="message">
                                        <div id="senderImg">
                                            <img class="senderImg" src="../images/profile-pic.jpg" width="50" height="50" />
                                        </div>
                                        <div id="message-txt-area">

                                            <div id="senderName">
                                                <p:commandLink styleClass="senderName" value="#{userMsg.userFullname}" action="#{myProfileManagedBean.loadProfileFrontInformation(userMsg.userId)}"></p:commandLink>
                                            </div>
                                            <div class="message-txt">
                                                #{userMsg.message}
                                            </div>
                                            <div id="msgAction">
                                                <!--                                                <a href="#" onclick="messageDialog.show()">Reply</a>-->
                                                <p:commandLink styleClass="reply-btn" value="Reply" oncomplete="messageDialog.show()" update=":messagesForm:dialogGrid">
                                                    <f:param name="userMsg" value="#{userMsg}" />
                                                </p:commandLink>
                                                <p:commandLink styleClass="open-btn" value="Open" onclick="openMessage(#{userMsg.userId})">
                                                    <f:param name="userMsg" value="#{userMsg}" />
                                                </p:commandLink>
                                            </div>

                                            <div id="openMessage">
                                                This is the new message. This is the new message. This is the new message. 
                                                This is the new message. This is the new message. This is the new message. 
                                                This is the new message. This is the new message. This is the new message. 
                                                This is the new message. This is the new message. This is the new message. 
                                                This is the new message. This is the new message. This is the new message. 
                                            </div>

                                        </div>
                                    </div>

                                </ui:repeat>
                                <center>
                                    <h:commandButton value="&lt; prev" action="#{messagesManagedBean.paginator1.prev}"/>
                                    <h:outputText value="#{messagesManagedBean.paginator1.pageIndex} / #{messagesManagedBean.paginator1.pages}"/>
                                    <h:commandButton value="next &gt;" action="#{messagesManagedBean.paginator1.next}"/>
                                    <h:inputHidden value="#{messagesManagedBean.paginator1.pageIndex}"/>
                                </center>

                            </div>
                        </h:form>



                    </div>
                </div>
            </div>

            <div id="right-pane">
                <div id="right-vline">
                    <img class="v-differenciator" src="../images/differentiator.jpg" />
                </div>

                <div id="right-suggestions-top">
                    <center>
                        <p>Profiles you may like</p>
                    </center>
                    <div id="right-suggestions-top-wrapper">
                        <div id="p-info-area-top-sugesstion">
                            <div id="p-img-sugesstion-top" >
                                <img src="../images/profile-pic.jpg" width="50" height="50"></img>
                            </div>
                            <div id="p-text-sugesstion-top" >
                                <p>Sania Mirza</p>


                                21<br/>
                                Muslim<br/>
                                Pakistan-Islamabad




                            </div>
                        </div>
                        <div id="p-info-area-top-sugesstion">
                            <div id="p-img-sugesstion-top" >
                                <img src="../images/profile-pic.jpg" width="50" height="50"></img>
                            </div>
                            <div id="p-text-sugesstion-top" >
                                <p>Sania Mirza</p>


                                21<br/>
                                Muslim<br/>
                                Pakistan-Islamabad




                            </div>
                        </div>
                        <div id="p-info-area-top-sugesstion">
                            <div id="p-img-sugesstion-top" >
                                <img src="../images/profile-pic.jpg" width="50" height="50"></img>
                            </div>
                            <div id="p-text-sugesstion-top" >
                                <p>Sania Mirza</p>


                                21<br/>
                                Muslim<br/>
                                Pakistan-Islamabad




                            </div>
                        </div>

                    </div>
                    <center>
                        <a href="">View More..</a>
                    </center>



                </div>
                <div id="right-suggestions-bottom">
                    <center>
                        <p>People Who might be Interested in you</p>
                    </center>
                    <div id="right-suggestions-top-wrapper">
                        <div id="p-info-area-top-sugesstion">
                            <div id="p-img-sugesstion-top" >
                                <img src="../images/profile-pic.jpg" width="50" height="50"></img>
                            </div>
                            <div id="p-text-sugesstion-top" >
                                <p>Sania Mirza</p>


                                21<br/>
                                Muslim<br/>
                                Pakistan-Islamabad




                            </div>
                        </div>
                        <div id="p-info-area-top-sugesstion">
                            <div id="p-img-sugesstion-top" >
                                <img src="../images/profile-pic.jpg" width="50" height="50"></img>
                            </div>
                            <div id="p-text-sugesstion-top" >
                                <p>Sania Mirza</p>


                                21<br/>
                                Muslim<br/>
                                Pakistan-Islamabad




                            </div>
                        </div>
                        <div id="p-info-area-top-sugesstion">
                            <div id="p-img-sugesstion-top" >
                                <img src="../images/profile-pic.jpg" width="50" height="50"></img>
                            </div>
                            <div id="p-text-sugesstion-top" >
                                <p>Sania Mirza</p>


                                21<br/>
                                Muslim<br/>
                                Pakistan-Islamabad




                            </div>
                        </div>

                    </div>
                    <center>
                        <a href="">View More..</a>
                    </center>



                </div>
                <div id="fb-twitter-icons" >

                    <img class="fb-icon" src="../images/fb-icon.jpg" />
                    <img class="twitter-icon" src="../images/twitter-icon.jpg" />
                </div>
                <div id="fb-twitter-labels">
                    <h:outputLabel  style="color: #680B0C;font-weight: bold;" value="Share &amp; likes"/>
                </div>
                <div id="text-info-profile" >
                    <b>Want to know why you are still single?</b>
                    <p>
                        We understand it is not easy to find a suitable match,ShadiBandhan.com provides safe plateform to find your ideal match.
                    </p>
                    <a href="#">[Read More..]</a>
                </div>




            </div>
        </div>

        <div id="footer">
            <ui:insert name="footer" >
                <ui:include src="footer.xhtml" />
            </ui:insert>
        </div>

    </h:body>
</html>

Now,
I want that

  1. The messages currently showing on the main page will be like “hello
    its my…” and
  2. when a person clicks on the open, a div is slided down, in which
    there will be full message shown and a reply and close button.

I’m using primefaces, if there’s a control in primefaces which i can use to achieve this whole thingy, please let me know. I thought of creating dynamic div id’s but didn’t know how to make it work, that’s why posting here…

Any suggestions are appreciated.

  • 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-05T15:57:33+00:00Added an answer on June 5, 2026 at 3:57 pm

    Give those elements a classname. Element IDs must be unique throughout the document and JSF-generated IDs are clumsy to select in jQuery. A classname can be used on multiple elements and it’s easier to select in jQuery.

    Something like this

    <ui:repeat value="#{bean.messages}" var="message">
        <div class="message">
            <div class="short">
                <p>#{message.short}<a href="#" class="more">more</a></p>
            </div>
            <div class="full">
                <p>#{message.full}</p>
                <h:commandButton value="Reply" action="#{bean.reply(message)}" />
            </div>
        </div>
    </ui:repeat>
    

    with this CSS

    .message .full {
        display: none;
    }
    

    and this JS

    $(".message .short .more").click(function() {
        var $message = $(this).closest(".message");
        $(".short", $message).hide();
        $(".full", $message).slideDown();
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my XML file chapters tag has more chapter tag.i need to display chapters
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to understand how to use SyndicationItem to display feed which is
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
i want to parse a xhtml file and display in UITableView. what is the
I'm making a simple page using Google Maps API 3. My first. One marker
I used javascript for loading a picture on my website depending on which small
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Basically, what I'm trying to create is a page of div tags, each has

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.