JSP and variable value from zscript

asked 2013-04-18 12:22:36 +0800

tarmo gravatar image tarmo

I don't understand how use variables what are declared inside zscript. I have a small jsp file for testing. It contain only one textbox. And it value should be come from zsStr variable. But textbox is empty. Same window code working in zul file but not in jsp. What is wrong?

Many thanks

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib uri="http : //www.zkoss.org/jsp/zul" prefix="z"%> <html> <head/> <body> <z:page> <z:window title="Variable value from zscript" border="normal"> <z:zscript> String zsStr = "This is a zscript variable"; </z:zscript> <z:textbox value="${zsStr}"/> </z:window> </z:page> </body> </head>

delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2013-06-04 06:57:49 +0800

zernolo gravatar image zernolo

The code you posted it's very hard to read... By the way... The thing it's wrong it's the environment. Zscript are compiled and runned at runtime when the page is rendered by Zk on server, so a variable created in zscript is not shared with the jsp page generated code. In your code every zk tag is executed onr by one by jsp, not all in one time, as usual by zk render mechanism. You have to put zscript variables in a place, (may be the session?) where other tag can reach them.

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

1 follower



Asked: 2013-04-18 12:22:36 +0800

Seen: 18 times

Last updated: Jun 04 '13

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