📄 relationaction.java
字号:
package struts.action;
import org.apache.struts.action.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import struts.actionform.RelationListForm;
import bo.RelationDetailBo;
public class RelationAction
extends Action {
private String forward= null;
private RelationListForm form = null;
/**
* Process the specified HTTP request, and create the corresponding HTTP
* response (or forward to another web component that will create it), with
* provision for handling exceptions thrown by the business logic.
*
* @param mapping The ActionMapping used to select this instance
* @param form The optional ActionForm bean for this request (if any)
* @param request The HTTP request we are processing
* @param response The HTTP response we are creating
* @throws Exception if the application business logic throws an exception
* @return ActionForward
* @todo Implement this org.apache.struts.action.Action method
*/
public ActionForward execute(ActionMapping mapping, ActionForm aform,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
form = (RelationListForm)aform;
String sn = request.getParameter("relationSn");
if (sn != null)
{
form.setRelationSn(sn);
}
String action =form.getEvent();
forwardMapping(action,request);
return mapping.findForward(forward);
}
private void forwardMapping(String action ,HttpServletRequest request) throws Exception
{
RelationDetailBo bo = RelationDetailBo.getInstance();
if (action == null || action.trim().equals("") || action.equals("back"))
{
bo.getPageableRelationDetailList(form);
forward = "relationlistpage";
}
else if (action.equals("add"))
forward = "add";
else if (action.equals("delete"))
{
String mess = bo.deleteRelationBySn(form);
form.setMessage(mess);
bo.getPageableRelationDetailList(form);
forward = "relationlistpage";
}
else if (action.equals("view"))
{
bo.getRelationBySn(form);
forward = "view";
}
else if (action.equals("savenew"))
{
String mess = bo.saveNewRelation(form);
form.setMessage(mess);
bo.getPageableRelationDetailList(form);
forward = "relationlistpage";
}
else if (action.equals("savemodify"))
{
String mess = bo.saveModifyRelation(form);
form.setMessage(mess);
bo.getPageableRelationDetailList(form);
forward = "relationlistpage";
}
else
throw new UnsupportedOperationException("不支持的操作!");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -