JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » AJAX討論區  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友    訂閱主題
reply to topicthreaded modego to previous topicgo to next topic
本主題所含的標籤
無標籤
作者 @ZKSelector("#submit") Button submit 請教
jhanaaron





發文: 1
積分: 0
於 2016-07-22 05:34 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
請問一下各位高手們,我用 ZK + Spring MVC 架構寫測試用程式,而我的 public String edit(@ZKSelector("#lbbb") Label lbbb, @ZKSelector("#submit") Button submit) 有用到 @ZKSelector 來將 ZK UI 的 Label及Button 帶入 Controller 的 edit() 裏,但是取到的 label value及 button lable 卻是空值,不知為何是這樣呢?有哪一位高手有知道的,可否告知小弟問題在哪呢?以下是我的測試程式,謝謝!

zul:
<zk xmlns:ca="client/attribute">
<window title="MyTest" border="normal">
New Content Here!
<listbox id="list" ca:data-springmvc-trigger="onSelect" ca:data-springmvc-action="mytest/edit">
<listhead>
<listheader label="Message"/>
</listhead>
<listitem>
<listcell>
  <checkbox label="laaa" value="checklaaa"/>
</listcell>
</listitem>
</listbox>

<button id="submit" label="click" ca:data-springmvc-action="mytest/update"/>
<label id="lbbb" value="bbb"/>
</window>
</zk>

java:
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.SessionAttributes;
import org.zkoss.zkspringmvc.ZKModelAndView;
import org.zkoss.zkspringmvc.annotation.ZKSelector;
import org.zkoss.zul.Button;
import org.zkoss.zul.Label;

@Controller
@RequestMapping("/mytest")
@SessionAttributes("todoList")
public class MyTest {
  
  @RequestMapping(method=RequestMethod.GET)
  public String defaultrun(ModelMap mode){
    
    System.out.println("Default Run......");    
    return "test";
    
  }
  
  @RequestMapping(value="/edit",method=RequestMethod.POST)
  public String edit(@ZKSelector("#lbbb") Label lbbb,
          @ZKSelector("#submit") Button submit){
    
   System.out.println("Edit 2 Run......");
   System.out.println("ZKModelAndView = " + ZKModelAndView.SELF.toString());
   System.out.println("lbbb value = " + lbbb.getValue());
   System.out.println("submit lable = " + submit.getLabel());
   lbbb.setValue("ccc");
   submit.setLabel("cancel");
  
   return ZKModelAndView.SELF;
  }
  
  @RequestMapping(value="update",method=RequestMethod.POST)
  public String update(ModelMap model){
    
   System.out.println("Update 11 Run......");
  
   ModelMap model2 = new ModelMap();
   model2.addAllAttributes(model);
  
   return ZKModelAndView.SELF;  
  
  }


reply to postreply to post
» JWorld@TW »  AJAX討論區

reply to topicthreaded modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8