5 Replies Latest reply on Aug 16, 2008 2:57 PM by Razia Bhayani

    Problem in displaying right output

    Razia Bhayani Newbie
      Hey All,

      Just getting this weird problem. In my .xhtml page I am listing few entries, the list of items User bought. There's an option to delete the same by the user at the side of the list. Now when I delete anything from top or between all goes well. However when I delete sometime from bottom the entire list disappear and it says no items in the list. And when I refresh the page I can see other items.

      Can someone explain whats the issue?

      here's the snippet:

      </s:div>
                          
                          <s:div id="voicemessage" rendered="#{uservoicemessages.rowAvailable}">
                               <h:dataTable value="#{uservoicemessages}"  var="phone">
                                    <h:column>
                                         <f:facet name="header">Read</f:facet>
                                         <h:outputText value="#{phone.read}"></h:outputText>
                                    </h:column>
                                    <h:column>
                                         <f:facet name="header">From</f:facet>
                                         <h:outputText value="#{phone.phoneAddress}"></h:outputText>
                                    </h:column>

                                    <h:column>
                                         <f:facet name="header">Date</f:facet>
                                         <h:outputText value="#{phone.dateAddedOn}"></h:outputText>
                                    </h:column>

                                    <h:column>
                                         <s:button value="Delete" action="#{showuservoicemessage.delete}" />
                                    </h:column>

                                    <h:column>
                                         <s:button value="Play" action="#{showuservoicemessage.play}"></s:button>
                                    </h:column>
                                    
                               </h:dataTable>
                          </s:div>


      PLease help....ASAP

        • 1. Re: Problem in displaying right output
          Daniel Hinojosa Master

          <s:button> doesn't submit the form. Was that intentional?
          Can we also see your backing beans (uservoicemessages, showuservoicemessage) for that?

          • 2. Re: Problem in displaying right output
            Razia Bhayani Newbie
            here's the backing bean

            @DataModelSelection
            @Out(required = false)
            private UserVoiceMessage uservoicemessage;

            @Stateful
            @Name("showuservoicemessage")
            public class VoiceMessageAction implements VoiceMessage, Serializable {

            public String delete() {
                            if (uservoicemessage != null) {
                                    uservoicemessages.remove(uservoicemessage);
                                    em.remove(uservoicemessage);
                                    uservoicemessage = null;
                                    setStatus(false);
                            }
                            return findVoiceMessage();
                    }

                    @Begin
                    @Factory("uservoicemessages")
                    @SuppressWarnings("unchecked")
                    public String findVoiceMessage() {
                            uservoicemessages = em.createQuery(
                                            "select o from UserVoiceMessage o where o.user = :user")
                                            .setParameter("user", user).getResultList();

                            uservoicemessage = null;

                            return "voicemessage";
                    }
                   
                    public void play() {
                            if (uservoicemessage != null) {
                                   
                                    String muccWebAudioDir = null;
                                    String MUCC_WEB_AUDIO_WAR = "mucc-web-audio.war";

                                    String JBOSS_BIND_ADDRESS = System.getProperty(
                                                    "jboss.bind.address", "127.0.0.1");
                                   
                                    String fileName = uservoicemessage.getFileName();
                                   
                                    muccWebAudioDir = (new StringBuffer("http://").append(
                                                    JBOSS_BIND_ADDRESS).append(":8080/").append(MUCC_WEB_AUDIO_WAR)
                                                    .append("/audio/")).append(fileName).toString();
                                   
                                    System.out.println("The muccWebAudioDir is:" +muccWebAudioDir);
                                    uservoicemessage.setRead(true);
                                    setCurrentVoiceMessage(muccWebAudioDir);//filePath
                                    setStatus(true);
                            }
                    }
            }
            • 3. Re: Problem in displaying right output
              Razia Bhayani Newbie

              Can anyone please help me on this ASAP?


              It's getting a bit critical for me.



              Please....

              • 4. Re: Problem in displaying right output
                Nicklas Karlsson Master

                s:button still doesn't submit the form.

                • 5. Re: Problem in displaying right output
                  Razia Bhayani Newbie

                  I am using this and form does get submitted...