[jboss-user] [JBoss Seam] - Re: Problems when paginating with search criterias

uke do-not-reply at jboss.com
Fri Sep 28 04:53:28 EDT 2007


This is the code as it looks now. One problem is that the s:links put the searchCriteria as a get-parameter, which messes up some characters. Is it possible to html-encode it in some way?

I tried to solve problem no2 by adding a hidden field in the search-form, which sets firstResult to 0, but that didn't do anything, perhaps because get-parameters are prioritized over post-parameters?

components.xml:

  | <fwk:entity-query name="users"
  |                   entity-manager="#{entityManager}"
  |                   ejbql="from User"
  |                   order="name"
  |                   max-results="10">
  |     <fwk:restrictions>
  |         <value>lower(name) like lower(concat(#{searchCriteria},'%'))</value>
  |     </fwk:restrictions>
  | </fwk:entity-query>
  | 

pages.xml:

  | <page view-id="/listUsers.xhtml"> 
  |     <param name="firstResult" value="#{users.firstResult}"/>
  |     <param name="searchCriteria" value="#{searchCriteria}"/>
  | </page>
  | 

listUsers.xhtml:

  | <h:form>
  | 	<h:inputText name="searchCriteria" value="#{searchCriteria}"/>
  | 	<h:commandButton value="Search"/>
  | </h:form>
  | <h:dataTable value="#{users.resultList}"var="user">
  | 	<h:column>
  | 		<s:link view="/viewUser.xhtml" value="#{user.name}"> 
  | 			<f:param name="userId" value="#{user.id}"/>
  | 		</s:link> 
  | 	</h:column> 
  | </h:dataTable>
  | <s:link rendered="#{users.previousExists}" value="First">
  | 	<f:param name="firstResult" value="0"/>
  | </s:link>
  | <s:link rendered="#{users.previousExists}" value="Previous">
  | 	<f:param name="firstResult" value="#{users.previousFirstResult}"/>
  | </s:link>
  | <s:link rendered="#{users.nextExists}" value="Next">
  | 	<f:param name="firstResult" value="#{users.nextFirstResult}"/>
  | </s:link>
  | <s:link rendered="#{users.nextExists}" value="Last">
  | 	<f:param name="firstResult" value="#{users.lastFirstResult}"/>
  | </s:link>
  | 

Thanks in advance
Sebastian

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4089597#4089597

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4089597



More information about the jboss-user mailing list