0

ZK-JSP and Spring IoC

asked 2010-12-01 05:26:59 +0800

Mikkel gravatar image Mikkel
6

I'm trying to use Spring IoC with ZK jsp tags. Specifically, I'm trying to use a Spring configured bean as Composer for my jsp/zk page, but at the moment the composer is apparently not even being instantiated. I would greatly appreciate any suggestions about what I'm doing wrong or an example on how to do this correctly. I have reduced the code to only include the relevant parts:

The jsp page:

<%@ page language="java" errorPage="/error.jsp" pageEncoding="UTF-8" contentType="text/html;charset=utf-8" %>
<%@ taglib prefix="zk" uri="http://www.zkoss.org/jsp/zul" %>
<zk:page>
    <zk:variable-resolver use="org.zkoss.zkplus.spring.DelegatingVariableResolver"/>
    <zk:window id="zkWin" apply="${phonePickerHandler}" >
   ... snip ...  
    </zk:window>
</zk:page>

The spring application context:

<bean id="phonePickerHandler" class="dk.telmore.app.webapp.action.PhonePickerHandler" scope="prototype">
    <property name="otaOmaService" ref="otaOmaService"/>
</bean>
 
<bean id="otaOmaService" class="dk.telmore.app.service.impl.OtaOmaServiceImpl" scope="singleton">
    <property name="terminalService">
        <bean class="dk.telmore.ws.client.Terminal.TerminalService" />
    </property>
</bean>

The composer class:

public class PhonePickerHandler extends GenericAutowireComposer {
    public PhonePickerHandler() {
        System.out.println("PhonePickerHandler constructor called");
    }

    public void setOtaOmaService(OtaOmaService otaOmaService) {
        this.otaOmaService = otaOmaService;
    }

    @Override
    public void doAfterCompose(Component comp){
        try {
            super.doAfterCompose(comp);
        } catch (Exception e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }
        System.out.println("PhonePickerHandler doAfterCompose called");

}

Any help would be greatly appreciated. Thanks in advance,

delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2011-03-10 09:18:06 +0800

Wrath gravatar image Wrath
3

Hi,

I am facing the same problem now. Did you manage to solve it? Can you please , help me on this ?

Thanks in advance

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-12-01 05:26:59 +0800

Seen: 395 times

Last updated: Mar 10 '11

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