Of course, here is the jsp:

<%@ taglib uri="http://java.sun.com/jsf/core"; prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsf/html"; prefix="h"%>
<%...@taglib uri="http://myfaces.apache.org/tomahawk"; prefix="t"%>
<%@ page contentType="text/html; charset=UTF-8"%>
<f:view>
        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
        <f:loadBundle basename="messages" var="msg" />
        <HTML>
        <HEAD>
        <LINK REL="STYLESHEET" HREF="./css/styles.css" TYPE="text/css">
        <meta http-equiv="content-type" content="text/html;charset=UTF-8">
        </HEAD>
        <BODY>
        <CENTER>
        <P><h:form>
                <P><h:commandButton value="#{msg.bt1}"
                        action="#{queryBean.register4}" /> <h:commandButton
                        value="push me empty" action="#{queryBean.register5}" />
                Query: <h:inputText value="#{queryBean.query}" />
                <H2>Start data table</H2>
                <h:dataTable value="#{queryBean.dataList}" var="item"
                        border="1">
                        <h:column>
                                <f:facet name="header">
                                        <h:commandLink value="ID" 
actionListener="#{queryBean.sort}">
                                                <f:attribute name="sortField" 
value="id" />
                                        </h:commandLink>
                                </f:facet>
                                <h:outputText value="#{item.id}" />
                        </h:column>
                        <h:column>
                                <f:facet name="header">
                                        <h:commandLink value="Name"
                                                
actionListener="#{queryBean.sort}">
                                                <f:attribute name="sortField" 
value="name" />
                                        </h:commandLink>
                                </f:facet>
                                <h:outputText value="#{item.name}" />
                        </h:column>
                </h:dataTable>

                <%-- The paging buttons --%>
                <h:commandButton value="first" action="#{queryBean.pageFirst}"
                        disabled="#{queryBean.firstRow == 0}" />
                <h:commandButton value="prev"
                        action="#{queryBean.pagePrevious}"
                        disabled="#{queryBean.firstRow == 0}" />
                <h:commandButton value="next" action="#{queryBean.pageNext}"
                        disabled="#{queryBean.firstRow + queryBean.rowsPerPage 
>=
queryBean.totalRows}" />
                <h:commandButton value="last" action="#{queryBean.pageLast}"
                        disabled="#{queryBean.firstRow + queryBean.rowsPerPage 
>=
queryBean.totalRows}" />
                <h:outputText
                        value="Page #{queryBean.currentPage} / 
#{queryBean.totalPages}" />
                <br />

                <%-- The paging links --%>
                <t:dataList value="#{queryBean.pages}" var="page">
                        <h:commandLink value="#{page}"
                                actionListener="#{queryBean.page}"
                                rendered="#{page != queryBean.currentPage}" />
                        <h:outputText value="#{page}" escape="false"
                                rendered="#{page == queryBean.currentPage}" />
                </t:dataList>
                <br />

                <%-- Set rows per page --%>
                <h:outputLabel for="rowsPerPage" value="Rows per page" />
                <h:inputText id="rowsPerPage" value="#{queryBean.rowsPerPage}"
                        size="3" maxlength="3" />
                <h:commandButton value="Set" action="#{queryBean.pageFirst}" />
                <h:message for="rowsPerPage" errorStyle="color: red;" />

                <%-- Cache bean with data list, paging and sorting variables 
for next
request --%>
                <t:saveState value="#{queryBean}" />

        </h:form>
        </CENTER>
        </BODY>
        </HTML>
</f:view>

If I populate the text field for the query, then hit the commandButton which
associated with the register4() method (poor name, I know, just
practicing...), then the query in the backing bean remains empty (the
default value) ,and the setter is not invoked.

Should I attach the backing bean code as well?


Richard Yee-3 wrote:
> 
> Can you send you code? There must be something else going on as a  
> result of your refactoring because package location of classes does  
> not matter to JSF.
> 
> Richard
> 
> Sent from my iPhone
> 
> On May 31, 2009, at 12:12 AM, Dvora <[email protected]> wrote:
> 
>>
>> Hello all,
>>
>> I'm new to JSF, and i'm studying mainly by looking code examples.  
>> One of the
>> examples I'm learning now is
>> http://balusc.blogspot.com/2008/10/effective-datatable-paging-and-sorting.html
>>  
>> .
>> Everything is working (so far so cool), but, if I refactor the DTO  
>> MyData to
>> be sit in other package than the backing bean, then commandButtons not
>> always working (i.e. no data refreshed on the jsf page and  
>> breakpoints on
>> the backing bean are never reached).
>> Is this behaviour expected? Where should I tell JSF about other  
>> packages I'm
>> using?
>>
>> Thanks for any help!
>> -- 
>> View this message in context:
>> http://www.nabble.com/Packaging-issues-tp23800484p23800484.html
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Packaging-issues-tp23800484p23800926.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.

Reply via email to