📄 pclbaction.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package cangku.action;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
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 cangku.javabeans.CKSql;
import cangku.javabeans.DBConn;
import cangku.javabeans.StorageBean;
/**
* MyEclipse Struts
* Creation date: 09-10-2007
*
* XDoclet definition:
* @struts.action scope="request" validate="true"
*/
public class PclbAction 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) {
// TODO Auto-generated method stub
//Integer warehouseid = new Integer((String) request.getSession()
// .getAttribute("wareID")); //获得当前登陆的仓库ID
String name="jhyy";
String warehouseID="1";
String warehouse="青岛仓库";
request.getSession(true).setAttribute("name", name); //当前登陆的仓库ID和仓库整个过程都有效
request.getSession(true).setAttribute("wareID", warehouseID);
request.getSession(true).setAttribute("ware", warehouse);
Integer warehouseid = new Integer(warehouseID);
String target="error"; //库存没有药品
Connection conn=null;
conn=DBConn.getconn();
PreparedStatement sta=null;
ResultSet rs=null;
//ckcuyp="select * from storage where warehouseID=? "; 调出仓库所有药品的ID,名称和数量
String ckcuyp=CKSql.ckcuyp;
List yplist=new ArrayList();
try {
sta=conn.prepareStatement(ckcuyp);
sta.setInt(1,warehouseid.intValue() );
rs=sta.executeQuery();
while(rs.next()){
StorageBean sb=new StorageBean();
sb.setID(new Integer(rs.getInt("ID")));
sb.setDrugID(new Integer(rs.getInt("drugID")));
sb.setDrugname(rs.getString("drugname"));
sb.setCounts(new Integer(rs.getInt("counts")));
yplist.add(sb);
target="success"; //调出库存药品信息
}
request.setAttribute("culist", yplist);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return mapping.findForward(target);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -