package com.cp.adrabi.jln.web.todo.controllers; import org.zkoss.zk.ui.Executions; import org.zkoss.zul.Messagebox; import org.zkoss.zul.Textbox; import com.cp.adrabi.jln.model.Todo; /** * Controller for adding new Todo in database * * @author ADRABI Abderrahim (z3vil) * */ public class ControllerNewTodo extends ControllerBaseTodo { /** * */ private static final long serialVersionUID = 1L; private Textbox txtSummary; private Textbox txtDescription; public void onClick$btnSave() throws InterruptedException { this.validateValue(txtSummary, Todo.class, "summary", this.txtSummary.getText()); this.validateValue(this.txtDescription, Todo.class, "description", this.txtDescription.getText()); this.fireValidation(); Todo todo = new Todo(); todo.setSummary(this.txtSummary.getText()); todo.setDescription(this.txtDescription.getText()); this.service.saveTodo(todo); Messagebox.show("Todo Saved successfully"); this.onClick$btnBack(); // :D } public void onClick$btnBack() { Executions.sendRedirect("/admin/todo/list"); } }
By viewing downloads associated with this article you agree to the Terms of use and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
Skills that self-taught computer programmers lack