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

📄 advancedsearchform.java

📁 本系统实现了从五个网站上搜索的图书进行整合后
💻 JAVA
字号:
package com.booksearch.actionform;



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

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

public class AdvancedSearchForm extends ActionForm {
	
	private static final long serialVersionUID = 1L;
	
	/* 高级搜索中图书名对应的参数 */
	private String bookName;
	/* 高级搜索中图书作者对应的参数 */
	private String bookAuthor;
	/* 高级搜索中图书出版社对应的参数 */
	private String bookPublisher;
	/* 高级搜索中图书isbn对应的参数 */
	private String bookISBN;
	/* 高级搜索中最低价格对应的参数 */
	private String minPrice;
	/* 高级搜索中最高价格对应的参数 */
	private String maxPrice;
	/* 高级搜索中起始出版年对应的参数 */
	private String publishUpYear;
	/* 高级搜索中起始出版月对应的参数 */
	private String publishUpMonth;
	/* 高级搜索中终止出版年对应的参数 */
	private String publishDownYear;
	/* 高级搜索中出版月对应的参数 */
	private String publishDownMonth;

	public String getBookName() {
		return bookName;
	}

	public void setBookName(String bookName) {
		this.bookName = bookName.trim();
	}

	public String getBookAuthor() {
		return bookAuthor;
	}

	public void setBookAuthor(String bookAuthor) {
		this.bookAuthor = bookAuthor.trim();
	}

	public String getBookPublisher() {
		return bookPublisher;
	}

	public void setBookPublisher(String bookPublisher) {
		this.bookPublisher = bookPublisher.trim();
	}

	public String getBookISBN() {
		return bookISBN;
	}

	public void setBookISBN(String bookISBN) {
		this.bookISBN = bookISBN.trim();
	}

	public String getMinPrice() {
		return minPrice;
	}

	public void setMinPrice(String minPrice) {
		
		if("".equals(minPrice.trim())||null == minPrice)
			this.minPrice="0.00";
		else
		this.minPrice = minPrice.trim();
	}

	public String getMaxPrice() {
		
		return maxPrice;
	}

	public void setMaxPrice(String maxPrice) {
		
		if("".equals(maxPrice.trim())||null == maxPrice)
			this.maxPrice = "0.00";
		else this.maxPrice = maxPrice.trim();
	}

	public String getPublishUpYear() {
		return publishUpYear;
	}

	public void setPublishUpYear(String publishUpYear) {
		this.publishUpYear = publishUpYear.trim();
	}

	public String getPublishDownMonth() {
		return publishDownMonth;
	}

	public void setPublishDownMonth(String publishDownMonth) {
		this.publishDownMonth = publishDownMonth.trim();
	}

	public String getPublishUpMonth() {
		return publishUpMonth;
	}

	public String getPublishDownYear() {
		return publishDownYear;
	}

	public void setPublishUpMonth(String publishUpMonth) {
		this.publishUpMonth = publishUpMonth.trim();
	}

	public void setPublishDownYear(String publishDownYear) {
		this.publishDownYear = publishDownYear.trim();
	}

	public ActionErrors validate(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		ActionErrors errors = new ActionErrors();
		if ((this.getBookAuthor() == null || "".equals(this.getBookAuthor()))
				&& (this.getBookISBN() == null
				|| "".equals(this.getBookISBN()))
				&& (this.getBookName() == null
				|| "".equals(this.getBookName()))
				&& (this.getBookPublisher() == null
				|| "".equals(this.getBookPublisher()))
				&& ("0.00".equals(this.getMaxPrice()))
				&& ("0.00".equals(this.getMinPrice()))
				&& (this.getPublishUpYear() == null
				|| "".equals(this.getPublishUpYear()))
				&& (this.getPublishUpMonth() == null
				|| "".equals(this.getPublishUpMonth()))
				&& (this.getPublishDownYear() == null
				|| "".equals(this.getPublishDownYear()))
				&& (this.getPublishDownMonth() == null
				|| "".equals(this.getPublishDownMonth()))) {
			errors.add("error", new ActionMessage("error.keyword"));
		}
		return errors;
	}
}

⌨️ 快捷键说明

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