📄 instoreaction.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.rfid.struts.action;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessages;
import com.rfid.dao.TInStoreDAO;
import com.rfid.dao.TStoreProductsDAO;
import com.rfid.global.CharFilter;
import com.rfid.global.Global;
import com.rfid.model.TUSer;
import com.rfid.struts.form.InStoreForm;
import com.rfid.struts.form.StoreProductsForm;
/**
* MyEclipse Struts
* Creation date: 11-04-2006
*
* XDoclet definition:
* @struts.action path="/inStore" name="inStoreForm" scope="request"
*/
public class InStoreAction extends Action {
/*
* Generated Methods
*/
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
InStoreForm inStoreForm = (InStoreForm) form;// TODO Auto-generated method stub
ActionForward forward = new ActionForward();
ActionMessages msgs = new ActionMessages();
/* 获得用户信息 */
HttpSession session = request.getSession();
TUSer user = (TUSer)session.getAttribute(Global.USER);
if(user == null)
{
request.setAttribute("error", "非法输入");
forward = new ActionForward("","/pages/error.jsp",true);
return forward;
}
if(inStoreForm == null){
request.setAttribute("error", "非法输入");
forward = new ActionForward("","/pages/error.jsp",true);
return forward;
}
String todo = inStoreForm.getTodo();
if(todo == null ){
request.setAttribute("error", "非法输入");
forward = new ActionForward("","/pages/error.jsp",true);
return forward;
} else if(todo.equals("search")){
String name = "";
if(inStoreForm.getName() != null){
name = inStoreForm.getName();
}
TInStoreDAO dao = new TInStoreDAO();
List inList = dao.searchByName(CharFilter.convertISO2Utf(name));
session.setAttribute("inList", inList);
forward = new ActionForward("","/pages/warehouse/warehouse_in.jsp",true);
return forward;
} else if(todo.equals("instore")){
String name = CharFilter.convertISO2Utf(inStoreForm.getName());
int number = inStoreForm.getNumber();
int orderid = inStoreForm.getOrderid();
int result = new TStoreProductsDAO().insert(name.trim(), number,orderid , user.getId());
if(result == 1){
forward = new ActionForward("","/pages/warehouse/warehouse_in.jsp",true);
} else{
forward = new ActionForward("","/pages/error.jsp",true);
}
return forward;
}
request.setAttribute("error", "非法输入");
forward = new ActionForward("","/pages/error.jsp",true);
saveMessages(request, msgs);
return forward;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -