📄 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 + -