0

ZK+Spring MVC: How is Spring ModelAndView object accessed from zul view

asked 2010-07-09 02:14:54 +0800

thrane gravatar image thrane
43 3

Hello Forum,

I'm using Spring MVC with ZK and I create a Spring MVC ModelAndView in a controller and populate it with data for the view.
But I can't find any way to access/resolve the ModelAndView in a my views which are implemented as ZUL files.

I use the both the

<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" ?>

in my views, but they seem to resolve my variable names to beans in my web application context?!

So:

1) How can I resolve variables in a ZUL views to the content of a Spring MVC model, i.e. an ModelAndView object?

2) How of the two resolvers gives me access to @{xzy} notation when accessing Spring beans?

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2010-07-11 11:02:33 +0800

iantsai gravatar image iantsai
2755 1

I think currently Spring MVC ModelAndView is still a page based technology, I'm not sure the way you integrate this two.

Can you show me your Spring MVC config xml and how you bind it to the ZK Component(The annotation declaration)?

link publish delete flag offensive edit

answered 2010-07-11 13:55:59 +0800

caclark gravatar image caclark
1753 2 5
http://clarktrips.intltwi...

I haven't looked at the specific Spring Controller code in awhile, but I think it puts the ModelAndView as a request attribute. If so, you could create your own DelegatingVariableResolver and have it look for the bean in the request first and then in the Spring WebApplicationContext if it doesn't find it. The class org.zkoss.zkplus.databind.AnnotateDataBinderInit is very small and could be cloned and customized easily.

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: 2010-07-09 02:14:54 +0800

Seen: 1,069 times

Last updated: Jul 11 '10

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