?? jfsaveaction.java
字號(hào):
package org.helpsoft.contract.struts.actions;
import org.apache.struts.*;
import org.apache.struts.action.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.text.*;
import java.math.*;
import org.helpsoft.contract.dao.*;
import org.helpsoft.contract.dto.*;
import org.helpsoft.contract.factory.*;
import org.helpsoft.contract.struts.forms.*;
public class JfSaveAction extends Action
{
/**
* method'execute'
*
* @param mapping
* @param form
* @param request
* @param response
* @throws Exception
* @return ActionForward
*/
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
{
try {
// cast the form to the appropriate type
JfForm jfForm = (JfForm) form;
// create the DAO class
JfDao dao = JfDaoFactory.create();
Jf dto = new Jf();
dto.setJfbm( jfForm.getJfbm());
dto.setJfmc( jfForm.getJfmc());
if (jfForm.getCrudMethod().equalsIgnoreCase("insert")) {
dao.insert( dto );
} else if (jfForm.getCrudMethod().equalsIgnoreCase("update")) {
dao.update( dto.createPk(), dto );
} else if (jfForm.getCrudMethod().equalsIgnoreCase("delete")) {
dao.delete( dto.createPk() );
}
return mapping.findForward( "success" );
}
catch (Exception e) {
ActionErrors _errors = new ActionErrors();
_errors.add( ActionErrors.GLOBAL_ERROR, new ActionError("internal.error", e.getClass().getName() + ": " + e.getMessage() ) );
saveErrors( request, _errors );
return mapping.findForward( "failure" );
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -