⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 addownerform.java

📁 spring 框架代码
💻 JAVA
字号:
package org.springframework.samples.petclinic.web;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.samples.petclinic.Owner;
import org.springframework.web.servlet.ModelAndView;

/**
 * JavaBean form controller that is used to add a new <code>Owner</code> to the system.
 *
 * @author Ken Krebs
 */
public class AddOwnerForm extends AbstractClinicForm {

	public AddOwnerForm() {
		setCommandName("owner");
		// OK to start with a blank command object
		setCommandClass(Owner.class);
		// activate session form mode to allow for detection of duplicate submissions
		setSessionForm(true);
	}

	/** Method inserts a new <code>Owner</code>. */
	protected ModelAndView onSubmit(Object command) throws ServletException {
		Owner owner = (Owner) command;
		// delegate the insert to the Business layer
		getClinic().storeOwner(owner);
		return new ModelAndView(getSuccessView(), "ownerId", owner.getId());
	}

	protected ModelAndView handleInvalidSubmit(HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		return disallowDuplicateFormSubmission(request, response);
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -