📄 itemattrshandler.java
字号:
package com.jdon.estore.web.catalog;
import com.jdon.strutsutil.ModelHandler;
import com.jdon.strutsutil.ModelForm;
import javax.servlet.http.HttpServletRequest;
import com.jdon.controller.model.Model;
import com.jdon.controller.events.EventModel;
import com.jdon.controller.events.Event;
import com.jdon.estore.catalog.ProductManagerLocal;
import com.jdon.estore.FrameworkServices;
import com.jdon.bussinessproxy.ServiceServerFactory;
import com.jdon.bussinessproxy.EJBDefinition;
public class ItemAttrsHandler implements ModelHandler {
private final static String module = ItemAttrsHandler.class.getName();
private final static ServiceServerFactory sf = ServiceServerFactory.
getInstance();
public ModelForm initForm(HttpServletRequest request) throws java.lang.
Exception {
AttributeForm form = new AttributeForm();
String Id = request.getParameter("itemId");
if ( (Id == null) || (Id.length() == 0))
throw new Exception("must supply itemId in jsp");
form.setItemId(Id);
return form;
}
public Model findModelByKey(String keyValue, HttpServletRequest request) throws
java.lang.Exception {
ProductManagerLocal productManager = (ProductManagerLocal) sf.getService(
FrameworkServices.ProductEJB, request);
return productManager.getItemAttrsById(keyValue);
}
public void serviceAction(EventModel em, HttpServletRequest request) throws
java.lang.Exception {
ProductManagerLocal productManager = (ProductManagerLocal) sf.getService(
FrameworkServices.ProductEJB, request);
try {
switch (em.getActionType()) {
case Event.CREATE:
productManager.createAttrs(em);
break;
case Event.EDIT:
productManager.updateAttrs(em);
break;
case Event.DELETE:
productManager.deleteAttrs(em);
break;
}
} catch (Exception ex) {
throw new Exception("System operation Error:" + ex);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -