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