-
FEATURED COMPONENTS
First time here? Check out the FAQ!
org.zkoss.zk.ui.UiException: can't find Page to resolve a view model class :'com.product.webapp.billing.ClaimMainVM' at [file:/F:/MyDocuments/Java/ZK7PMS/HealthSystem/Healthcare/src/main/webapp/zk/billing/claimmain.zul, line:4, nearby column: 39]
I am getting the error sometime. Not able to trace it. But sometime it works well
this error happens in org.zkoss.bind.BindComposer.initViewModel(BindEvaluatorX, Component)
in case the component is not attached to a page when it is initialized.
with the current details I cannot tell what leads to this situation in your case. Can you post the relevant code of your zul file, and any related code, that maybe creates/adds/removes this component dynamically? Then I can have a closer look.
Robert
Thank you robert. I will take one more look in detail and let you know. Because it works well in other places with the same code.
Yes it is related to container component issue when trying to load the zul file. Sorry to include another issue here. I am also getting the following which could not able to trace it
I have a global error handler and on clicking the close button i am getting the client error.
Here is the error zul file
<?page title="new page title" contentType="text/html;charset=UTF-8"?>
<zk>
<window title="Application Error Handler" mode="modal" border="normal"
maximizable="false" closable="true" position="center,parent"
action="hide: slideUp" sclass="mymodal" id="errordialog"
onCancel="@command('closeThis')" apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('com.product.webapp.main.ErrorDialogVM')">
<separator />
<hlayout sclass="z-valign-middle">
<fimageerror onClick="@command('showErrorDetail')" />
<flabel value="We're Sorry! " sclass="flblerror" />
<space></space>
</hlayout>
<separator />
<label pre="true" value="@bind(vm.sorryMessage)" />
<separator />
<separator />
<flabel value="We apologize for the inconvenience." />
<div width="100%" sclass="sectionSeperator"
style="margin-left: 0px;">
</div>
<div align="center">
<fbutton label="Close" id="Close"
onClick="@command('closeThis')" />
</div>
</window>
</zk>
Here is the VM
package com.product.webapp.main;
import java.util.HashMap;
import org.zkoss.bind.annotation.AfterCompose;
import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.ContextParam;
import org.zkoss.bind.annotation.ContextType;
import org.zkoss.bind.annotation.ExecutionArgParam;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.Sessions;
import org.zkoss.zk.ui.select.Selectors;
import org.zkoss.zk.ui.select.annotation.Wire;
import org.zkoss.zul.Window;
public class ErrorDialogVM {
@Wire("#errordialog")
private Window win;
private Integer errCode;
private String errMessage;
private String sorryMessage;
private Exception exception;
private String moreErrorInfo;
public String getSorryMessage() {
return sorryMessage;
}
public void setSorryMessage(String sorryMessage) {
this.sorryMessage = sorryMessage;
}
public String getMoreErrorInfo() {
return moreErrorInfo;
}
public void setMoreErrorInfo(String moreErrorInfo) {
this.moreErrorInfo = moreErrorInfo;
}
@AfterCompose
public void initSetup(@ContextParam(ContextType.VIEW) Component view,
@ExecutionArgParam("map") HashMap<String, Object> map) {
Selectors.wireComponents(view, this, false);
this.errCode = 0;
this.errMessage = "";
this.exception = (Exception) map.get("Exception");
this.moreErrorInfo = (String) map.get("moreErrorInfo");
this.sorryMessage = "An unexpected error occured.Our Engineers have been notified of this \nproblem and expect to resolve it shortly.";
}
@Command
public void closeThis() {
win.detach();
}
@Command
public void showErrorDetail() {
final HashMap<String, Object> map = new HashMap<String, Object>();
map.put("errCode", this.errCode);
map.put("errMessage", this.errMessage);
map.put("exception", this.exception);
map.put("errFrom", "Application Error Handler");
map.put("moreErrorInfo", moreErrorInfo);
Sessions.getCurrent().setAttribute("errordetail", map);
Executions.getCurrent().sendRedirect("/errordetail.zul", "_blank");
win.detach();
}
}
Senti, wouldn't it be better to use @Init
in stead of the MVC way @AfterCompose
(the wire you could also remove with @ContextParam(ContextType.VIEW) Component view
in the command. If you remove the zk
tag I'm sure the component is instance of window.
The zk
is a null component to be XML applient, but if you remove it, your zul is still xml applient cause window
is the root tag.
No Luck after your suggestion. In the console, i can see the following error 11:45:20.586 [http-bio-8080-exec-10] ERROR org.zkoss.zk.ui.impl.DesktopImpl - [Desktop z_cic:/zk/main/main.zul] client error: Failed to process rm Cannot read property '$n' of null (TypeError)
Again, it occurs sometime and sometime it works well :)
aha, i found the problem. If i remove the following code in zul , it works fine
action="hide: slideUp"
but i have the same thing in all my project with same ZK Version, there it works well.
Asked: 2015-01-07 19:34:00 +0800
Seen: 100 times
Last updated: Jan 08 '15