0

Not an Unique Id Space error while passing value from one Controller to another controller

asked 2011-02-25 04:23:35 +0800

yaryan997 gravatar image yaryan997
210 2

I am able to pass my basecontroller value to my traditional_retailer by using the below code

my BaseController is

public class BaseController extends GenericForwardComposer implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	final Log logger = LogFactory.getLog(getClass());
	
	protected Window filter_bar;
	protected Listbox lbox_service;
	protected Listbox lbox_season;
	
	private String seasonId = "0";
	private String service_id = "0";
	
	private CertilogoServiceDao certilogoServiceDao;
	private AnnotateDataBinder binder;

	protected transient Map<String, Object> args;
	
	@SuppressWarnings("unchecked")
	public Map<String, Object> getCreationArgsMap(Event event) {
		CreateEvent ce = (CreateEvent) ((ForwardEvent)event).getOrigin();
		return ce.getArg();
	}
	
	public void doOnCreateCommon(Window w, Event fe) throws Exception {
		CreateEvent ce = (CreateEvent) ((ForwardEvent) fe).getOrigin();
		args = ce.getArg();
	}
	
	public void onCreate$filter_bar(Event event) throws Exception {
		logger.info("ON CREATE EXECUTE");
		System.out.println("Create");
		
		lbox_service.setModel(new ListModelList(certilogoServiceDao.getAllServices()));
		lbox_season.setModel(new ListModelList(certilogoServiceDao.getAllSeason()));
		
		ListModelList lml_service = (ListModelList) lbox_service.getModel();
		ListModelList lml_season = (ListModelList) lbox_season.getModel();
				
		logger.info("Done");
	}

	public void setCertilogoServiceDao(CertilogoServiceDao certilogoServiceDao) {
		this.certilogoServiceDao = certilogoServiceDao;
	}

	public CertilogoServiceDao getCertilogoServiceDao() {
		return certilogoServiceDao;
	}
	
	public String getSeasonId() {
		return lbox_season.getSelectedItem().getValue().toString();
	}

	public void setSeasonId(String seasonId) {
		this.seasonId = seasonId;
	}

	public String getService_id() {
		return lbox_service.getSelectedItem().getValue().toString();
	}

	public void setService_id(String serviceId) {
		service_id = serviceId;
	}

	public void onClick$Hello(Event event) throws Exception {
		final Map<String,Object> map = new HashMap<String,Object>(0);
		logger.info("Service Id :"+this.getService_id());
		logger.info("Season Id :"+this.getSeasonId());
		
		map.put("service_id", this.getService_id());
		map.put("season_id", this.getSeasonId());
		map.put("baseController", this);
		
		//final Window win = (Window) Executions.createComponents("traditional.zul", null, map) ;
		
		try {
			Executions.createComponents("traditional.zul", null, map);
		}catch(final Exception e) {
			logger.error("onOpenWindow:: error opeingin window / " +e.getMessage());
		}
		
	}
	
}

and my Filter_bar.zul file is

<?page title="Filter Bar Page" contentType="text/html;charset=UTF-8"?>
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" ?>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<zk>
<window id="filter_bar" title="Filter Bar Page" border="normal" apply="${baseController}">
	Brand :<listbox id="lbox_service" 
			width="120px" mold="select" 
			multiple="false" rows="1">
			<listitem self="@{each=each1}" label="@{each1.serviceName}" value="@{each1.serviceId}"/>
		</listbox>
	
	Season :<listbox id="lbox_season"
			width="120px" mold="select"
			multiple="false" rows="1">
			<listitem self="@{each=each1}" label="@{each1.season}" value="@{each1.seasonId}"/>
		</listbox>
		
		<button id="Hello" label="Click Me"/>
</window>
</zk>

and my Traditional_retailers.java controller file is

public class TraditionalRetailers extends BaseController implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	protected Window traditional;
	protected String seasonId = "0";
	protected String service_id = "0";
	
	protected VerificationStoreHibernateDao verificationStoreHibernateDao;
	
	public String getSeasonId() {
		return seasonId;
	}

	public void setSeasonId(String seasonId) {
		this.seasonId = seasonId;
	}

	public String getService_id() {
		return service_id;
	}

	public void setService_id(String serviceId) {
		service_id = serviceId;
	}

	public void onCreate$traditional(Event event) throws Exception {
		Map<String, Object> args = getCreationArgsMap(event);
		
		if(args.containsKey("service_id")) {
			System.out.println("Service Id >>:"+args.get("service_id"));
			//service_id = args.get("service_id").toString();
			this.setService_id(args.get("service_id").toString());
		}else {
			System.out.println("None SErvice");
			this.setService_id("0");
		}
		
		if(args.containsKey("season_id")) {
			System.out.println("Season Id >>>:"+args.get("season_id"));
			//seasonId = args.get("season_id").toString();
			this.setSeasonId(args.get("season_id").toString());
		}else {
			System.out.println("None Season");
			this.setSeasonId("0");
		}
		
		String dateFrom = "";
		String dateTo = "";
		String order = "2";
		List TDRetailers = verificationStoreHibernateDao.getTraditionalRetailers(getService_id(),getSeasonId(),dateFrom,dateTo,order);
		
		System.out.print("TDretailes :" +TDRetailers);
	}

}

but my problem of

Failed to assign [id=traditional] to <Window z_n3l_7>
Not unique in ID space [Page z_n3l_0]: traditional
23:13:56,089 ERROR  onOpenWindow:: error opeingin window / Not unique in ID space [Page z_n3l_0]: traditional

is still there..

When I first I clich the HELLO BUTTON it takes the listbox value and pass them as param to traditional controller.. and my traditional.zul also run's file .

But once again when I click that button I gives me above error. and also the selected listbox value is not passed their..
so can you help me to these things done..

Best Regards
Yogendra

delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2011-02-25 06:59:13 +0800

caclark gravatar image caclark
1753 2 5
http://clarktrips.intltwi...

What you didn't show is the contents of traditional.zul. Something in that file has an id attribute and it's not getting destroyed properly when you do whatever you're doing to close it. So, when you try to open it again, ZK is saying "you have a component with that id already...you can't have 2".

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2011-02-25 04:23:35 +0800

Seen: 214 times

Last updated: Feb 25 '11

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More