📄 shititypeaction.java
字号:
package com.myExam.action;
import java.util.HashMap;
import java.util.Map;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.SimpleFormController;
import com.myExam.bean.ShitiType;
import com.myExam.domain.SetShitiType;
public class ShitiTypeAction extends SimpleFormController {
private String viewPage;
private SetShitiType setShitiType;
//实现onSubmit()方法
public ModelAndView onSubmit(Object command) throws Exception {
//强制转换成ShitiType
ShitiType shitiType = (ShitiType)command;
Map model = new HashMap();
getSetShitiType().insertShitiType(shitiType);
model.put("shitiType", shitiType);
model.put("msg", getSetShitiType().getMsg());
//返回到指定页面
return new ModelAndView(getViewPage(), model);
}
//依赖注入要返回的页面
public void setViewPage(String viewPage) {
this.viewPage = viewPage;
}
//获取要返回的页面
public String getViewPage() {
return viewPage;
}
/**返回setShitiType.
*/
public SetShitiType getSetShitiType() {
return setShitiType;
}
/**设定setShitiType
*/
public void setSetShitiType(SetShitiType setShitiType) {
this.setShitiType = setShitiType;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -