0

zul not communicated with composer after struts2 action redirection

asked 2011-10-19 10:25:54 +0800

vivekkumar20005 gravatar image vivekkumar20005
66 1

Hi All

I want to integrate zkoss with strust2.


OrderListComposer.zul

<window  id="test" apply="${orderListComposer}">
        <button id="testButton" label="test"/>
</window>


@org.springframework.stereotype.Component("orderListComposer")
@Scope("prototype")
public class OrderListComposer extends GenericForwardComposer{

public void onClick$testButton(){
      Window win = Executions.createComponents("/iframe.zul", null, null);
      Iframe  orderJspViewFile = (Iframe )win.getChildren().get(0);
      orderJspViewFile.setSrc("/welcome.action");// strust2 sction url

}

}

iframe.zul

<window>
      <iframe id="orderJspViewFile "/>
</window>

Struts action class
import com.opensymphony.xwork2.ActionSupport;

public class HelloWorld extends ActionSupport {
    
    @Action(value="/welcome",results={ @Result(name="success", type = "redirect", location="/welcome.zul")})
     public String execute() throws Exception {
       
        return SUCCESS;
    }

}

welcome.zul;

<window apply="${welcome}">
   <label id="nameLabel"/>
</window>

@org.springframework.stereotype.Component("welcome ")
@Scope("prototype")
public class Welcome extends GenericForwardComposer{

private Label nameLabel;
  public void doAfterCompose(Component comp) throws Exception {
        super.doAfterCompose(comp);
        nameLabel.setValue("successs full redirect by strust2 action");
    }

}

delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2011-10-19 21:42:57 +0800

matthewgo gravatar image matthewgo
375

Hi

You could try to specify type = "dispatcher" instead of type = "redirect"

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-10-19 10:25:54 +0800

Seen: 252 times

Last updated: Oct 19 '11

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