?? exampleaction.java
字號:
package com.struts2.example.action;
import java.util.List;
import com.struts2.example.model.Example;
import com.struts2.example.service.IExampleService;
import com.struts2.framework.action.AbstractAction;
import com.struts2.framework.application.Pager;
import com.struts2.framework.application.PagerService;
public class ExampleAction extends AbstractAction {
private static final long serialVersionUID = -2525705730506745350L;
private IExampleService exampleService;
private Example example;
private Long exampleId;
private List examples;
private List nameList;
private String exampleNameKey;
public String getExampleNameKey() {
return exampleNameKey;
}
public void setExampleNameKey(String exampleNameKey) {
this.exampleNameKey = exampleNameKey;
}
public List getNameList() {
return nameList;
}
public void setNameList(List nameList) {
this.nameList = nameList;
}
public Example getExample() {
return example;
}
public void setExample(Example example) {
this.example = example;
}
public Long getExampleId() {
return exampleId;
}
public void setExampleId(Long exampleId) {
this.exampleId = exampleId;
}
public IExampleService getExampleService() {
return exampleService;
}
public void setExampleService(IExampleService exampleService) {
this.exampleService = exampleService;
}
public List getExamples() {
return examples;
}
public void setExamples(List examples) {
this.examples = examples;
}
/**
* @see 根據ID獲得一個Example
* @return
* @throws Exception
*/
public String load() throws Exception {
if (exampleId != null) {
example = exampleService.getExample(exampleId);
return SUCCESS;
} else {
return ERROR;
}
}
/**
* @see 獲得所有的Example
* @return
* @throws Exception
*/
public String findAll() throws Exception {
examples=exampleService.getExamples(example);
return SUCCESS;
}
/**
* @see 自動填充組合框
* @return
* @throws Exception
*/
public String autoCompeleter() throws Exception {
nameList=exampleService.getNameList();
return SUCCESS;
}
/**
* @see 根據exampleName進行查詢
* @return
* @throws Exception
*/
public String findExample() throws Exception {
Example ex=new Example();
ex.setExampleName(exampleNameKey);
examples=exampleService.getExamples(ex);
return SUCCESS;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -