[jboss-user] [JBoss Seam] - why list empty

luc_yuan do-not-reply at jboss.com
Thu Jan 31 05:12:39 EST 2008


   In order not to use auto search,i make some change to the resultList,in my action i print the resultList info,there are datas,but when it comes to the page,the list becomes empty,why?
   list
   
  |    package org.domain.demo.session;
  | 
  | import org.domain.demo.entity.*;
  | import org.jboss.seam.ScopeType;
  | import org.jboss.seam.annotations.In;
  | import org.jboss.seam.annotations.Name;
  | import org.jboss.seam.annotations.Out;
  | import org.jboss.seam.annotations.Scope;
  | import org.jboss.seam.annotations.Transactional;
  | import org.jboss.seam.framework.EntityQuery;
  | 
  | import java.lang.reflect.Field;
  | import java.util.List;
  | import java.util.Arrays;
  | 
  | import javax.faces.model.DataModel;
  | import javax.persistence.Query;
  | 
  | import org.jboss.seam.faces.DataModels;
  | 
  | @Name("kokyakuList")
  | public class KokyakuList extends EntityQuery {
  | 
  | 	private static final long serialVersionUID = 1L;
  | 
  | 	private static final String[] RESTRICTIONS = {
  | 			"lower(kokyaku.kokyakuCd) like concat(lower(#{kokyakuList.kokyaku.kokyakuCd}))",
  | 			"lower(kokyaku.kokyakuName) like concat(lower(#{kokyakuList.kokyaku.kokyakuName}),'%')",
  | 			"lower(kokyaku.kokyakuKana) like concat(lower(#{kokyakuList.kokyaku.kokyakuKana}),'%')",
  | 			"lower(kokyaku.kokyakuAddr) like concat(lower(#{kokyakuList.kokyaku.kokyakuAddr}),'%')",
  | 			"lower(kokyaku.kokyakuTel) like concat(lower(#{kokyakuList.kokyaku.kokyakuTel}),'%')",
  | 			"lower(kokyaku.kokyakuFax) like concat(lower(#{kokyakuList.kokyaku.kokyakuFax}),'%')",
  | 			"lower(kokyaku.kokyakuMail) like concat(lower(#{kokyakuList.kokyaku.kokyakuMail}),'%')",
  | 			"lower(kokyaku.kokyakuNinzu) like concat(lower(#{kokyakuList.kokyaku.kokyakuNinzu}),'%')",
  | 			"lower(kokyaku.kokyakuPresidentName) like concat(lower(#{kokyakuList.kokyaku.kokyakuPresidentName}),'%')",
  | 			"lower(kokyaku.kokyakuGyosyu) like concat(lower(#{kokyakuList.kokyaku.kokyakuGyosyu}),'%')",
  | 			"lower(kokyaku.kokyakuNaiyo) like concat(lower(#{kokyakuList.kokyaku.kokyakuNaiyo}),'%')",
  | 			"lower(kokyaku.shain.syainCd) like concat(lower(#{kokyakuList.shainCd}))",};
  | 
  | 	private Kokyaku kokyaku = new Kokyaku();
  | 	
  | 	private String shainCd;
  | 			
  | 	private SearchCodition searchCodition = new SearchCodition();
  | 	
  | 	public SearchCodition getSearchCodition() {
  | 		return searchCodition;
  | 	}
  | 
  | 	public void setSearchCodition(SearchCodition searchCodition) {
  | 		this.searchCodition = searchCodition;
  | 	}
  | 
  | 	public String getShainCd() {
  | 		return shainCd;
  | 	}
  | 
  | 	public void setShainCd(String shainCd) {
  | 		this.shainCd = shainCd;
  | 	}
  | 
  | 	@Override
  | 	public String getEjbql() {
  | 			return "select kokyaku from Kokyaku kokyaku";
  | 		
  | 	}
  | 
  | 	@Override
  | 	public Integer getMaxResults() {
  | 		return 10;
  | 	}
  | 
  | 	public Kokyaku getKokyaku() {
  | 		return kokyaku;
  | 	}
  | 
  | 	@Override
  | 	public List<String> getRestrictions() {
  | 		return Arrays.asList(RESTRICTIONS);
  | 	}
  | 	
  | 	public String doSearch(){
  | 		
  | 		list = getResultList();
  | 		System.out.println(list.size());
  | 		return "success";
  | 	}
  | 	
  |         //i also try @DataModel
  | 	private List list;
  | 
  | 	public List getList() {
  | 		return list;
  | 	}
  | 
  | 	public void setList(List list) {
  | 		this.list = list;
  | 	}
  | 
  | 
  | }
  | 
  |    

   list
   
  |    <?xml version="1.0" encoding="Windows-31J"?>
  | <!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/template2.xhtml">
  | 
  | 	<ui:define name="pageTitle">
  | 		<h4>顧客æƒ
報検索</h4>
  | 	</ui:define>
  | 
  | 	<ui:define name="body">
  | 		<h:messages globalOnly="true" styleClass="message" id="globalMessages" />
  | 
  | 		<h:form id="kokyakuSearch" styleClass="edit"
  | 			style="margin-bottom:5px;">
  | 			<input type="hidden" name="firstLoad" value="2" />
  | 			<input type="hidden" name="firstResult" value="0" />
  | 			<rich:simpleTogglePanel label="検索条件" switchType="ajax">
  | 
  | 				<s:decorate template="layout/display.xhtml">
  | 					<ui:define name="label">顧客CD</ui:define>
  | 					<h:inputText id="kokyakuCd"
  | 						value="#{kokyakuList.kokyaku.kokyakuCd}" />
  | 				</s:decorate>
  | 
  | 				<s:decorate template="layout/display.xhtml">
  | 					<ui:define name="label">æ‹
当社員CD</ui:define>
  | 					<h:inputText value="#{kokyakuList.shainCd}"></h:inputText>
  | 				</s:decorate>
  | 
  | 				<div style="clear: both" />
  | 
  | 				<div class="actionButtons" align="right"><h:commandButton
  | 					id="search" value="検索" action="#{kokyakuList.doSearch}" /></div>
  | 
  | 			</rich:simpleTogglePanel>
  | 
  | 		</h:form>
  | 
  | 		<!-- Result List -->
  | 
  | 		<h:form id="update">
  | 			<rich:panel rendered="#{firstLoad != '1'}">
  | 				<f:facet name="header">検索結果</f:facet>
  | 				<div style="width: 100%;" class="results" id="kokyakuList"><h:outputText
  | 					value="No kokyaku exists"
  | 					rendered="#{empty kokyakuList.list}" /> <rich:dataTable
  | 					id="kokyakuList" var="kokyaku" value="#{kokyakuList.list}"
  | 					rows="10" columns="5"
  | 					rendered="#{not empty kokyakuList.list}">
  | 
  | 					<h:column>
  | 						<f:facet name="header">選択</f:facet>
  | 						<input type="radio" name="pid" id="pid"
  | 							value="#{kokyaku.kokyakuCd}" />
  | 					</h:column>
  | 					<h:column>
  | 						<f:facet name="header">
  | 							<s:link styleClass="columnHeader"
  | 								value="顧客CD #{kokyakuList.order=='kokyakuCd asc' ? messages.down : ( kokyakuList.order=='kokyakuCd desc' ? messages.up : '' )}">
  | 								<f:param name="order"
  | 									value="#{kokyakuList.order=='kokyakuCd asc' ? 'kokyakuCd desc' : 'kokyakuCd asc'}" />
  | 							</s:link>
  | 						</f:facet>
  |             #{kokyaku.kokyakuCd}
  |         </h:column>
  | 					<h:column>
  | 						<f:facet name="header">
  | 							<s:link styleClass="columnHeader"
  | 								value="顧客名称 #{kokyakuList.order=='kokyakuName asc' ? messages.down : ( kokyakuList.order=='kokyakuName desc' ? messages.up : '' )}">
  | 								<f:param name="order"
  | 									value="#{kokyakuList.order=='kokyakuName asc' ? 'kokyakuName desc' : 'kokyakuName asc'}" />
  | 							</s:link>
  | 						</f:facet>
  |             #{kokyaku.kokyakuName}
  |         </h:column>
  | 					<h:column>
  | 						<f:facet name="header">
  | 							<s:link styleClass="columnHeader"
  | 								value="æ‹
当社員CD #{kokyakuList.order=='shain.syainCd asc' ? messages.down : ( kokyakuList.order=='shain.syainCd desc' ? messages.up : '' )}">
  | 								<f:param name="order"
  | 									value="#{kokyakuList.order=='shain.syainCd asc' ? 'shain.syainCd desc' : 'shain.syainCd asc'}" />
  | 							</s:link>
  | 						</f:facet>
  |             #{kokyaku.shain.syainCd}
  |         </h:column>
  | 					<h:column>
  | 						<f:facet name="header">
  | 							<s:link styleClass="columnHeader"
  | 								value="æ‹
当社員名 #{kokyakuList.order=='shain.syainName asc' ? messages.down : ( kokyakuList.order=='shain.syainName desc' ? messages.up : '' )}">
  | 								<f:param name="order"
  | 									value="#{kokyakuList.order=='shain.syainName asc' ? 'shain.syainName desc' : 'shain.syainName asc'}" />
  | 							</s:link>
  | 						</f:facet>
  |             #{kokyaku.shain.syainName}
  |         </h:column>
  | 					<h:column>
  | 						<f:facet name="header">
  | 							<s:link styleClass="columnHeader"
  | 								value="取引開始日 #{kokyakuList.order=='startDate asc' ? messages.down : ( kokyakuList.order=='startDate desc' ? messages.up : '' )}">
  | 								<f:param name="order"
  | 									value="#{kokyakuList.order=='startDate asc' ? 'startDate desc' : 'startDate asc'}" />
  | 							</s:link>
  | 						</f:facet>
  | 						<h:outputLabel value="#{kokyaku.startDate}">
  | 							<s:convertDateTime type="date" pattern="yyyy/MM/dd" />
  | 						</h:outputLabel>
  | 					</h:column>
  | 				</rich:dataTable>
  | 				<div class="tableControl" align="right">
  | 				<div class="icon-h" align="right"><s:div styleClass="icon"
  | 					rendered="#{kokyakuList.previousExists}">
  | 					<s:link action="/KokyakuList.xhtml">
  | 						<h:graphicImage value="/img/dleft.png" width="15" height="15"
  | 							align="middle" />
  | 						<f:param name="firstResult" value="0" />
  | 					</s:link>
  | 					<s:link view="/KokyakuList.xhtml" value=" First Page"
  | 						id="firstPage">
  | 						<f:param name="firstResult" value="0" />
  | 					</s:link>
  | 				</s:div> <s:div styleClass="icon" rendered="#{kokyakuList.previousExists}">
  | 					<s:link action="/KokyakuList.xhtml">
  | 						<h:graphicImage value="/img/left.png" width="15" height="15"
  | 							align="middle" />
  | 						<f:param name="firstResult"
  | 							value="#{kokyakuList.previousFirstResult}" />
  | 					</s:link>
  | 					<s:link view="/KokyakuList.xhtml" value=" Previous Page"
  | 						id="previousPage">
  | 						<f:param name="firstResult"
  | 							value="#{kokyakuList.previousFirstResult}" />
  | 					</s:link>
  | 				</s:div> <s:div styleClass="icon" rendered="#{kokyakuList.nextExists}">
  | 					<s:link view="/KokyakuList.xhtml" value="Next Page " id="nextPage">
  | 						<f:param name="firstResult" value="#{kokyakuList.nextFirstResult}" />
  | 					</s:link>
  | 					<s:link action="/KokyakuList.xhtml">
  | 						<h:graphicImage value="/img/right.png" width="15" height="15"
  | 							align="middle" />
  | 						<f:param name="firstResult" value="#{kokyakuList.nextFirstResult}" />
  | 					</s:link>
  | 				</s:div> <s:div styleClass="icon-s" rendered="#{kokyakuList.nextExists}">
  | 					<s:link view="/KokyakuList.xhtml" value="Last Page " id="lastPage">
  | 						<f:param name="firstResult" value="#{kokyakuList.lastFirstResult}" />
  | 					</s:link>
  | 					<s:link action="/KokyakuList.xhtml">
  | 						<h:graphicImage value="/img/dright.png" width="15" height="15"
  | 							align="middle" />
  | 						<f:param name="firstResult" value="#{kokyakuList.lastFirstResult}" />
  | 					</s:link>
  | 				</s:div></div>
  | 
  | 				</div>
  | 				</div>
  | 				<div class="actionButtons" align="right"><h:commandButton
  | 					id="detailButton" value="詳細表示" action="#{kokyakuHome.detail}"
  | 					rendered="#{not empty kokyakuList.list}">
  | 				</h:commandButton> <h:commandButton id="updateButton" value="æ›´æ–°"
  | 					action="#{kokyakuHome.modify}"
  | 					rendered="#{not empty kokyakuList.list}">
  | 				</h:commandButton> <h:commandButton id="deleteButton" value="削除"
  | 					action="#{kokyakuHome.delete}"
  | 					rendered="#{not empty kokyakuList.list}">
  | 				</h:commandButton></div>
  | 
  | 				
  | 			</rich:panel>
  | 			<div class="actionButtons" align="right"><h:commandButton
  | 					action="#{kokyakuHome.createKokyaku}" id="create" value="新規登録">
  | 			</h:commandButton></div>
  | 		</h:form>
  | 
  | 
  | 	</ui:define>
  | 
  | </ui:composition>
  | 
  | 
  |      
     can someone give me some advice?

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

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




More information about the jboss-user mailing list