?? manageaction.java
字號:
request.getParameter("content");
OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream(
fileName), "UTF-8");
osw.write(content, 0, content.length());
osw.flush();
osw.close();
this.genIndexTop();
return mapping.findForward("doTopEdit");
}
public ActionForward toTopEditor(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws
Exception {
String fileName = getServlet().getServletContext().getRealPath("/") +
"htmlet/top_" + request.getParameter("top_id") +
".htm";
File f = new File(fileName);
if (!f.exists()) {
f.createNewFile();
}
//讀取排行榜文??
BufferedReader br = new BufferedReader(new InputStreamReader(new
FileInputStream(fileName), "UTF-8"));
String data = null;
String content = "";
while ((data = br.readLine()) != null) {
content = content + data;
}
br.close();
request.setAttribute("CONTENT", content);
return mapping.findForward("toTopEditor");
}
//推薦??
public ActionForward toRecTopManage(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws
Exception {
Vector r = new GoodsMgr().getTopByType(1);
//得到每個排行榜的內容
GenericVO tvo = null;
String fileName = null;
File f = null;
for (int i = 0; i < r.size(); i++) {
tvo = (GenericVO) r.elementAt(i);
fileName = getServlet().getServletContext().getRealPath("/") +
"htmlet/rectop_" + tvo.getItem("TOP_ID") + ".htm";
f = new File(fileName);
if (!f.exists()) {
f.createNewFile();
}
//讀取排行榜文??
BufferedReader br = new BufferedReader(new InputStreamReader(new
FileInputStream(fileName), "UTF-8"));
String data = null;
String content = "";
while ((data = br.readLine()) != null) {
content = content + data;
}
br.close();
tvo.add("CONTENT", content);
}
request.setAttribute("RESULT", r);
return mapping.findForward("toRecTopManage");
}
public ActionForward toRecTopAdd(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws
Exception {
return mapping.findForward("toRecTopAdd");
}
public ActionForward doRecTopAdd(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws
Exception {
GenericVO gvo = new GenericVO();
gvo = AppUtil.convertParameters(request, gvo); //將request 中的參數設置到cvo
new GoodsMgr().addTop(gvo);
return mapping.findForward("doRecTopAdd");
}
public ActionForward toRecTopModify(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws
Exception {
GenericVO tvo = new GoodsMgr().getTopDetail(BaseUtil.toInt(request.
getParameter("top_id")));
request.setAttribute("bean", tvo);
return mapping.findForward("toRecTopModify");
}
public ActionForward doRecTopModify(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws
Exception {
GenericVO gvo = new GenericVO();
gvo = AppUtil.convertParameters(request, gvo); //將request 中的參數設置到cvo
new GoodsMgr().modifyTop(gvo);
this.genIndexTop();
return mapping.findForward("doRecTopModify");
}
public ActionForward doRecTopDelete(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws
Exception {
new GoodsMgr().deleteTop(BaseUtil.toInt(request.getParameter("top_id")));
this.genIndexRecTop();
return mapping.findForward("doRecTopDelete");
}
public ActionForward toRecTopEdit(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws
Exception {
return mapping.findForward("toRecTopEdit");
}
public ActionForward doRecTopEdit(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws
Exception {
String fileName = getServlet().getServletContext().getRealPath("/") +
"htmlet/rectop_" + request.getParameter("top_id") +
".htm";
String content =
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">" +
request.getParameter("content");
OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream(
fileName), "UTF-8");
osw.write(content, 0, content.length());
osw.flush();
osw.close();
this.genIndexRecTop();
return mapping.findForward("doRecTopEdit");
}
public ActionForward toRecTopEditor(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws
Exception {
String fileName = getServlet().getServletContext().getRealPath("/") +
"htmlet/rectop_" + request.getParameter("top_id") +
".htm";
File f = new File(fileName);
if (!f.exists()) {
f.createNewFile();
}
//讀取排行榜文??
BufferedReader br = new BufferedReader(new InputStreamReader(new
FileInputStream(fileName), "UTF-8"));
String data = null;
String content = "";
while ((data = br.readLine()) != null) {
content = content + data;
}
br.close();
request.setAttribute("CONTENT", content);
return mapping.findForward("toRecTopEditor");
}
//推薦
public ActionForward toGoodManage(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws
Exception {
Vector r = new GoodsMgr().getTopGoodsType();
request.setAttribute("RESULT", r);
return mapping.findForward("toGoodManage");
}
public ActionForward toGoodDetail(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws
Exception {
//根據item取得欄目的名??
String item = request.getParameter("item");
String value = "";
if (item.equalsIgnoreCase("index")) {
value = "首頁";
} else {
value = new GoodsMgr().getGoodsTypeDetail(BaseUtil.toInt(item)).
getItemStr("TYPENAME");
}
//得到精品商品
Vector r = new GoodsMgr().getGoodByItem(item);
request.setAttribute("VALUE", value);
request.setAttribute("RESULT", r);
return mapping.findForward("toGoodDetail");
}
public ActionForward toGoodAdd(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws
Exception {
//設置查詢條件
GenericVO gvo = new GenericVO();
ListVO lvo = new ListVO();
gvo = AppUtil.convertParameters(request, gvo); //將request 中的參數設置到cvo\uFFFD?
lvo.setItemsPerPage(30);
lvo = AppUtil.processListVO(lvo, request); //設置ListVO
gvo.setListVO(lvo);
//查詢數據
lvo = new GoodsMgr().searchGoods(gvo);
gvo.setListVO(lvo);
//設置頁面數據
request.setAttribute("bean", gvo);
return mapping.findForward("toGoodAdd");
}
public ActionForward doGoodAdd(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws
Exception {
String[] goodIds = request.getParameterValues("good_id");
GoodsMgr gm = new GoodsMgr();
GenericVO gvo = new GenericVO();
for (int i = 0; i < goodIds.length; i++) {
gvo.add("ITEM", request.getParameter("item"));
gvo.add("GOODS_ID", goodIds[i]);
gm.AddGood(gvo);
}
if (request.getParameter("item").equalsIgnoreCase("index")) {
genIndexGoodsList();
}
return mapping.findForward("doGoodAdd");
}
public ActionForward doGoodDelete(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws
Exception {
new GoodsMgr().deleteGood(BaseUtil.toInt(request.getParameter("good_id")));
if (request.getParameter("item").equalsIgnoreCase("index")) {
genIndexGoodsList();
}
return mapping.findForward("doGoodDelete");
}
public ActionForward toPayMethodManage(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws
Exception {
Vector r = new GoodsMgr().getPayMethod();
request.setAttribute("RESULT", r);
return mapping.findForward("toPayMethodManage");
}
public ActionForward toPayMethodAdd(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws
Exception {
return mapping.findForward("toPayMethodAdd");
}
public ActionForward doPayMethodAdd(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws
Exception {
GenericVO gvo = new GenericVO();
gvo = AppUtil.convertParameters(request, gvo); //將request 中的參數設置到cvo
new GoodsMgr().addPayMethod(gvo);
return mapping.findForward("doPayMethodAdd");
}
public ActionForward toPayMethodModify(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -