-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello
Congratulatios for this cool framework.
I'm new with the zk framework. I need more performance in the zul files.
I have been mapping zk with Hibernate ussing the OpenSessionInViewListener in the zk.xml and i need to show the message exception from the db to the client via javascript (no Messagebox) because i loose performance using Messagebox.show()
This is my code:
in the index.zul:
---------------
<window id="winIndex" use="com.xxx.mw.rol.controlador.IndexWindow" width="300px">
in the com.xxx.mw.rol.controlador.IndexWindow.java:
--------------------------------------------------
public void ingresar() throws Throwable{
try{
//excluded code here
}catch(Throwable ex) {
Clients.evalJavaScript("alert('STATIC MESSAGE')");
}
}
I use the Clients.evalJavaScript to show a STATIC message but i need to show the hibernate exception message.
Actual message:
Clients.evalJavaScript("alert('STATIC MESSAGE')");
Needed message:
Clients.evalJavaScript("alert(' ? ')");
where
? = ex.toString() // Exception message from hibernate java in the SERVER SIDE.
How pass the ex.toString() java message to the Clients.evalJavaScript() function as javascript code for evaluation in the CLIENT SIDE?
Thanks for your help.
Best regards.
Clients.evalJavaScript("alert('\"+ex.toString()+\"')");
doesn't this work ?
but, you still need to escape character ' if ex.toString() has it.
I think create a dynamic window or popup to show the message it better than using javascript alert .
Are the dynamic window or dynamic popup more efficient that javascript alert() y the client side? Why?
Thanks for your suggestions.
Best regards.
The code:
Clients.evalJavaScript("alert(' \"+ex.toString()+\" ')");
Shows the next text: "+ex.toString()+"
Any suggestions?
Cool...
I wrote this code:
String str = ex.toString();
Clients.evalJavaScript("alert(' "+str+" ')");
and fixed it...
Thanks for all dennis!
Greetings from Ecuador.
Best regards.
Asked: 2008-11-10 13:15:09 +0800
Seen: 471 times
Last updated: Nov 10 '08