1 2 Previous Next 15 Replies Latest reply on Jul 26, 2008 1:07 PM by rbhayani

    Reload required...

    rbhayani

      Hi,


      If someone could please guide me with this issue?


      I am having a strange issue with seam. I have this '.xhtml' page, on which I have multiple rows of data getting populated. I have provided a button Delete next to each row. Now, when I click this button to delete the row, all goes well if I descend from top to bottom or if I delete and intermediate row. However when I try to delete the last row, all my entries disappear and I have to reload the page to see all my entries. They don't get deleted in one shot but they disappear and the page goes blank unless I refresh it.


      Why does this happen?


      Please keep advised.


      Thanks,
      Raziya

        • 1. Re: Reload required...
          nickarls

          Show code and setup.


          • 2. Re: Reload required...
            nickarls

            BTW, are you binding the table itself to a backing bean component and/or using immediate?

            • 3. Re: Reload required...
              rbhayani
              here's the code?

              <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                                    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
              <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                      xmlns:s="http://jboss.com/products/seam/taglib"
                      xmlns:ui="http://java.sun.com/jsf/facelets"
                      xmlns:f="http://java.sun.com/jsf/core"
                      xmlns:h="http://java.sun.com/jsf/html"
                      xmlns:rich="http://richfaces.org/rich" template="layout/template.xhtml">

                      <ui:define name="topnav">
                              <ui:include src="layout/mucc_nav.xhtml">
                                      <ui:param name="page" value="callblock" />
                              </ui:include>
                      </ui:define>

                      <ui:define name="body">
                              <h:form>
                                      <h:messages globalOnly="true" styleClass="message" />

                                      <rich:panel>
                                              <f:facet name="header">Call Block</f:facet>

                                              <f:subview id="no_blockaddress"
                                                      rendered="#{!userblockphoneaddresses.rowAvailable}">
                                                      <p><b>You have not set any blocking rules</b></p>
                                              </f:subview>

                                              <p>Set your call blocking rules here :</p>

                                              <f:subview id="blockaddress"
                                                      rendered="#{userblockphoneaddresses.rowAvailable}">
                                                      <h:dataTable value="#{userblockphoneaddresses}" var="phone">
                                                              <h:column>
                                                                      <f:facet name="header">Phone Address</f:facet>
                                                                      <h:outputText value="#{phone.phoneAddress}"></h:outputText>
                                                              </h:column>
                                                              <h:column>
                                                                      <h:commandButton value="Delete"
                                                                              action="#{showuserblockphoneaddresses.delete(phone)}" />
                                                              </h:column>
                                                      </h:dataTable>
                                              </f:subview>

                                              <dd><h:inputText
                                                      value="#{showuserblockphoneaddresses.phoneAddress}" size="15" /></dd>
                                              <dd><h:commandButton
                                                      action="#{showuserblockphoneaddresses.add}"
                                                      value="Add Block Address" /></dd>
                                      </rich:panel>

                              </h:form>
                      </ui:define>

              </ui:composition>
              • 4. Re: Reload required...
                rbhayani

                Yes I am binding Stateful bean as a backing bean of JSF

                • 5. Re: Reload required...
                  nickarls

                  Could you post the backing bean also?

                  • 6. Re: Reload required...
                    rbhayani
                    @Stateful
                    @Name("showuserblockphoneaddresses")
                    public class BlockAddressAction implements BlockAddress, Serializable {

                            @In(value = "currentUser", required = false)
                            User user;

                            @PersistenceContext(type = PersistenceContextType.EXTENDED)
                            EntityManager em;

                            @DataModel
                            List<UserBlockPhoneAddress> userblockphoneaddresses;

                    public String delete(UserBlockPhoneAddress selectedUserBlockPhoneAddress) {    
                                    if (selectedUserBlockPhoneAddress != null) {                   
                                            em.remove(selectedUserBlockPhoneAddress);
                                    }
                                    return findBlockAddresses();
                            }
                    • 7. Re: Reload required...
                      nickarls

                      The issue remains even if you have no subview?

                      • 8. Re: Reload required...
                        rbhayani

                        Haven't tried that yet...do you suggest to try that?

                        • 9. Re: Reload required...
                          nickarls

                          Doesn't hurt trying. Just guessing here...

                          • 10. Re: Reload required...
                            rbhayani

                            Oh ok then, lemme try it and see what happens. Will keep you posted about it.

                            • 11. Re: Reload required...
                              rbhayani
                              Hey Nicklas,

                              It's amusing...Its working...
                              What's the issue with <f:subview>? Do you have any justifications?

                              Thanks alot for your support.

                              regards,
                              Raziya
                              • 12. Re: Reload required...
                                nickarls

                                None whatsoever, just tried to isolate the problem. I've never used subviews, I usually stick to the rendered attribute on table itself or use some combination of s:div + rendered or ui:include

                                • 13. Re: Reload required...
                                  rbhayani
                                  Ok...

                                  There's another issue that I face. I have few recorded messages. I try to play them when someone presses a play button, and I give them an option to delete that message too.

                                  <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>

                                  I am using the <object> tag to insert the player on the xhtml page. With the autostart option set to true.

                                  <object classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="120" height="30">
                                                                                                    <param name="URL" value= {showuservoicemessage.currentVoiceMessage}"/>
                                           <param name="autoStart" value="true"/>
                                           <param name="uiMode" value="mini"/>
                                          <embed src="#{showuservoicemessage.currentVoiceMessage}" autostart="true"/>
                                  </object>

                                  However when the user presses delete, the last played message repeats itself. I believe this is happening because the "autostart=true". Can you please guide to have this problem fixed? Or if you could please suggest any other mechanism by which I can play the message?

                                  Regards,
                                  Raziya
                                  • 14. Re: Reload required...
                                    nickarls

                                    Never done it, but does it work if you place a s:div with some rendered condition that is flipped to false when you think the object-tag might fire when it shouldn't?

                                    1 2 Previous Next