此代码是在action里的,queryName和queryValue的值是从jsp传进来的protected String queryName;
protected String queryValue;
public String getQueryName() {
return queryName;
}
public void setQueryName(String queryName) {
this.queryName = queryName;
}
public String getQueryValue() {
return queryValue;
}
public void setQueryValue(String queryValue) {
this.queryValue = queryValue;
}public String save()throws Exception{
if(this.getBooks().getBookPrice().equals("")){
this.getBooks().setBookPrice("0.0");
}
String id = this.getBooks().getBookId();
Books books = bookService.getBook(id);
if(books==null){
bookService.addBook(this.getBooks());
}else{
bookService.updateBook(this.getBooks());
}
this.setQueryName(this.getQueryName());
this.setQueryValue(this.queryValue);
return SUCCESS;
}红色部分是不是多余的呀??this.getQueryName()出来的值再自己setQueryName(this.getQueryName())回去不是多余的吗?有什么不一样的?
protected String queryValue;
public String getQueryName() {
return queryName;
}
public void setQueryName(String queryName) {
this.queryName = queryName;
}
public String getQueryValue() {
return queryValue;
}
public void setQueryValue(String queryValue) {
this.queryValue = queryValue;
}public String save()throws Exception{
if(this.getBooks().getBookPrice().equals("")){
this.getBooks().setBookPrice("0.0");
}
String id = this.getBooks().getBookId();
Books books = bookService.getBook(id);
if(books==null){
bookService.addBook(this.getBooks());
}else{
bookService.updateBook(this.getBooks());
}
this.setQueryName(this.getQueryName());
this.setQueryValue(this.queryValue);
return SUCCESS;
}红色部分是不是多余的呀??this.getQueryName()出来的值再自己setQueryName(this.getQueryName())回去不是多余的吗?有什么不一样的?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货