package com.action; import java.sql.Connection; import java.util.ArrayList; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import org.apache.struts2.interceptor.ServletRequestAware; import com.opensymphony.xwork2.ActionSupport; import com.dao.GoodsTypeDao; import com.model.GoodsType; import com.util.DbUtil; public class IndexAction extends ActionSupport implements ServletRequestAware{ /** * */ private static final long serialVersionUID = 1L; private static DbUtil dbUtil=new DbUtil(); private static GoodsTypeDao goodstypedao=new GoodsTypeDao(); private static ArrayList<GoodsType> goodstypelist; private HttpServletRequest request; @Override public String execute() throws Exception { Connection con=null; HttpSession session=request.getSession(); con=dbUtil.getCon(); session.setAttribute("goodstypelist", goodstypelist); return "index"; } static{ Connection con=null; try { con=dbUtil.getCon(); goodstypelist=goodstypedao.getGoodsTypeList(con); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); }finally{ try { dbUtil.closeCon(con); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } } @Override public void setServletRequest(HttpServletRequest request) { this.request=request; } }

微信网友_6442962125967360 LV2
2023年5月9日
teamdragon LV6
2023年4月13日
sandihha LV9
2022年11月10日
WM2020 LV4
2022年6月20日
jwfadacai LV8
2022年4月30日
skook7 LV2
2022年4月20日
邬松桥 LV11
2022年4月5日
yscccc LV1
2022年2月22日
哈哈哈哈哈a LV10
2022年2月15日
wanglinddad LV55
2021年12月12日

longouxiu
3月1日
暂无贡献等级
Mhgfhjyrf LV3
2024年12月9日
wangqi_sheng LV1
2024年8月14日
liulian666 LV2
2024年7月22日
ma406805131 LV19
2024年6月29日
王佩琪 LV3
2024年6月14日
lilitu LV6
2024年5月26日
hongdongdong LV14
2024年5月7日
微信网友_6512020493586432 LV2
2024年4月9日
微信网友_6904205432819712 LV1
2024年3月12日