0

which controller to use when using ZKSpring.GenericForwardComposer vs Spring Controller

asked 2011-04-20 12:16:42 +0800

blacksensei gravatar image blacksensei
234 2

Hello Everyone!

i've beeing playing with zk a while and now comes serious things.
I've successfull integrated spring and zk and the routing
works as i use

 @controller
annotation.so far so good
Now i needed to call a webservice which return an arraylist of object
     import org.springframework.ui.Model;
     //.....
    @RequestMapping("/accounts/personal/list")
    public String list(Model model){

        try { 
            
            ArrayOfAccount result = port.getAccounts( null, 0, 20);
              //i thought with this i can grab the result collection.
              model.addAttribute(result);
        } catch (Exception ex) {
            // TODO handle custom exceptions here
        }

        return "accountslist";
    }

the real problem is to get the object in the result object in the zul file.

<?xml version="1.0" encoding="UTF-8"?>

<?init class="org.zkoss.zk.ui.util.Composition" arg0="/templates/mainlayout.zul"?>
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit"?>
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
<zk xmlns="http://www.zkoss.org/2005/zul" xmlns:n="http://www.zkoss.org/2005/zk/native">
    <window self="@{define(content)}">

        <div>
            <listbox model="${result}" id="lstAccount" multiple="true">
                <listhead>
                    <listheader label="Account Name" />
                    <listheader label="Account Type" />
                    <listheader label="Mobile Phone" />
                  
                </listhead>
                <listitem self="@{each='account'}" value="@{account}" >
                    <listcell label="@{account.getAccountName()}" />
                    <listcell label="@{account.getAccountType()}" />
                    <listcell label="@{account.getMobilePhone()}" />
                </listitem>
            </listbox>
        </div>
    </window>
  
</zk>


it's not throwing an error but i feel like i'm not doing something right.And i also know that i can use GenrericForwardComposer to achieve the
same wihtout hassle.this confuses me about whether i'm doing the right thing.

question 1 :
How can i achive what i was trying to do ?

question 2:
What's the best way using ZKspring(no webflows)? Spring Controller to do the routing and ForwardComposer to handle the ajax behaviors (ie events)?

question 3:
i'm using listbox in this but i would need to do things from context menu on selected object.do you thing grid is suitable for it?

thanks for reading this.

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2011-04-21 10:37:15 +0800

blacksensei gravatar image blacksensei
234 2

Nobody? :(

link publish delete flag offensive edit

answered 2011-05-01 22:15:48 +0800

RyanWu gravatar image RyanWu
533 2
about.me/flyworld

you better make sure you get the right object,
you can simply add ${result} on the zul, then it will print out the object

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-04-20 12:16:42 +0800

Seen: 454 times

Last updated: May 01 '11

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