updatebookaction.java

来自「学习Struts2 Spring Hibernate的好例子」· Java 代码 · 共 57 行

JAVA
57
字号
package com.firstssh.action;

import com.firstssh.model.Book;
import com.firstssh.service.IBookService;
import com.opensymphony.xwork2.ActionSupport;

public class UpdateBookAction  extends ActionSupport {
	private int bookid;
	private String bookname;
	private String author;
	private String price;
	private IBookService bookService;
	public String execute() throws Exception {
		Book book=new Book();
		book.setId(bookid);
		book.setBookname(bookname);
		book.setAuthor(author);
		book.setPrice(price);
		
		if(bookService.updateBook(book)){
			return SUCCESS;
		}else{
			return "exception";
		}
	}
	public String getBookname() {
		return bookname;
	}
	public void setBookname(String bookname) {
		this.bookname = bookname;
	}
	public String getAuthor() {
		return author;
	}
	public void setAuthor(String author) {
		this.author = author;
	}
	public String getPrice() {
		return price;
	}
	public void setPrice(String price) {
		this.price = price;
	}
	public IBookService getBookService() {
		return bookService;
	}
	public void setBookService(IBookService bookService) {
		this.bookService = bookService;
	}
	public int getBookid() {
		return bookid;
	}
	public void setBookid(int bookid) {
		this.bookid = bookid;
	}
}

⌨️ 快捷键说明

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