📄 personwindow.java
字号:
package com.zk;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.ServletContext;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import org.zkoss.zk.ui.Execution;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zul.*;
import org.zkoss.zkplus.spring.*;
import com.model.*;
public class PersonWindow extends Window {
private final Execution exec;
public PersonWindow() {
exec = Executions.getCurrent();
final String sn = exec.getServerName();
final int sp = exec.getServerPort();
}
public void onCreate(Event evt) {
Textbox uname = (Textbox)this.getFellow("uname");
}
public void onAdd(){
try {
// ApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext((ServletContext) getDesktop().getWebApp().getNativeContext());
// com.hbmDAO.PersonDAO uimpl = (com.hbmDAO.PersonDAO) ctx.getBean("personDAO");
com.hbmDAO.PersonDAO uimpl = (com.hbmDAO.PersonDAO) SpringUtil.getBean("personDAO");
Person user = new Person();
user.setPerson_name("插入成功");
user.setPwd("1khf");
uimpl.insert(user);
Messagebox.show("插入成功", "Success", Messagebox.OK, Messagebox.INFORMATION);
} catch (InterruptedException ex) {
Logger.getLogger(PersonWindow.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -