-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I have my application in production and want change the view layer to put ZK there...
I take all attributes in my jsp with request.getAttribute("xpto").. I want one way to get my attributes in my Zks components from the request.. I don't want use .zul and don't want create one more class to my jsp
How is it possible? Expression lenguage maybe? How I can populate a <z:listbox> with my attribute from the request?
Do you have an example for this? A tutorial? Any helps is well come!!
Thaks a lot
n4rk0
I do this and works fine
but my problem is with a list.. How is it possible? Expression lenguage maybe? How I can populate a <z:listbox> with my attribute from the request?
see this
http://www.zkoss.org/forum/listComment/10019
Hi,victorhugomunizm
you can refer to http://www.zkoss.org/smalltalks/zuljspII/
but zkjsp spec is changed
you must to set Variable like: page.setVariable("list", list);
this is my demo
<%@ page import="java.util.*"%> <%@ page import="java.text.*"%> <%@ taglib uri="http://www.zkoss.org/jsp/zul" prefix="z"%> <z:init use="org.zkoss.zkplus.databind.AnnotateDataBinderInit"/> <% request.setAttribute("my_text", "Texto ZK");// use Request to store and pass data. LinkedList<Properties> list = new LinkedList<Properties>(); Properties p1 = new Properties(); p1.setProperty("nome", "ABCD"); p1.setProperty("email", "[email protected]"); Properties p2 = new Properties(); p2.setProperty("nome", "EFGH"); p2.setProperty("email", "[email protected]"); list.add(p1); list.add(p2); request.setAttribute("list", list); LinkedList<String> list2 = new LinkedList<String>(); list2.add("ABCD"); list2.add("EFGH"); request.setAttribute("list2", list2); %> <z:page> <z:zscript> list = requestScope.get("list"); page.setVariable("list", list); </z:zscript> <z:window title="Hello World!!" border="normal" width="100%"> <z:groupbox id="gb" mold="3d" width="100%"> <z:label value="${my_text}" /> </z:groupbox> <z:groupbox> <z:listbox id="feedListBox" model="@{list}"> <z:listhead sizable="true"> <z:listheader label="Name" width="100px" /> <z:listheader label="Email" width="250px" /> </z:listhead> <z:listitem self="@{each='my'}"> <z:listcell label="@{my.nome}"/> <z:listcell label="@{my.email}"/> </z:listitem> </z:listbox> </z:groupbox> </z:window> </z:page>
My friend
why we have do this
<z:zscript>
list = requestScope.get("list");
page.setVariable("list", list);
</z:zscript>
No have possible don't do this and use EL like ${list}
???
another question...
why my header don't show me the label???
this...
<z:listheader label="Name" width="100px" />
don't appear the label 'Name' ...why??
because @{list} is handle by <z:init use="org.zkoss.zkplus.databind.AnnotateDataBinderInit"/>
so it only can get Variable in zk
it can't get request scope Variable in @{list}
so we need to transfer data between JSP and ZK.
because zk AnnotateDataBinder not support to get request scope Variable
I try my sample code
the header is show well
did you test my sample code ?
thanks for de explanition
yes I try, but don't appear... I creat another jsp, I test in another browser...
where is possible I post a print screen to you see what I am talking
what happened... my label don't works fine
what I can do??
I created another project to but the labels don't appear
one thing so easy can be so complicated... how is it possible?
you can update your zuljsp.jar to 1.4
I try with zk 3.6.2 and zk 5
I update my zuljsp.jar to 1.4
I prepared a .zul file and works fine but in my jsp the problem continues
what else I can do to solve this problem??
thanks a lot
Asked: 2009-10-26 05:52:23 +0800
Seen: 992 times
Last updated: Oct 30 '09