ProductModify.jsp
上传用户:lsj999sz
上传日期:2022-06-15
资源大小:4717k
文件大小:6k
源码类别:

ICQ/即时通讯

开发平台:

Java

  1. <%@ page language="java" import="com.bjsxt.shopping.product.*" pageEncoding="GBK"%>
  2. <%@ page import="com.bjsxt.shopping.category.*" %>
  3. <%@ page import="java.util.*"%>
  4. <%
  5. request.setCharacterEncoding("GBK");
  6. int id = Integer.parseInt(request.getParameter("id"));
  7. Product p = ProductMgr.getInstance().loadById(id);
  8. String action = request.getParameter("action");
  9. if(action != null && action.trim().equals("add")) {
  10. String name = request.getParameter("name");
  11. double normalPrice = Double.parseDouble(request.getParameter("normalPrice"));
  12. double memberPrice = Double.parseDouble(request.getParameter("memberPrice"));
  13. int categoryId = Integer.parseInt(request.getParameter("categoryId"));
  14. String descr = request.getParameter("descr");
  15. p.setName(name);
  16. p.setNormalPrice(normalPrice);
  17. p.setMemberPrice(memberPrice);
  18. p.setDescr(descr);
  19. p.setCategoryId(categoryId);
  20. p.setPdate(new Date());
  21. ProductMgr.getInstance().update(p);
  22. out.println("更新成功!");
  23. %>
  24. <script type="text/javascript">
  25. <!--
  26. parent.main.location.reload();
  27. //-->
  28. </script>
  29. <%
  30. }
  31.  %>
  32. <html><head><title>金尚商城产品添加</title>
  33. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  34. <meta name="keywords" content="Discuz!,Board,Comsenz,forums,bulletin board,">
  35. <meta name="description" content="醒客论坛专区  - Discuz! Board">
  36. <meta name="generator" content="Discuz! 4.0.0RC4 with Templates 4.0.0">
  37. <meta name="MSSmartTagsPreventParsing" content="TRUE">
  38. <meta http-equiv="MSThemeCompatible" content="Yes">
  39. <style type="text/css"><!--
  40. a { text-decoration: none; color: #000000 }
  41. a:hover { text-decoration: underline }
  42. body { scrollbar-base-color: #F3F6FA; scrollbar-arrow-color: #4D76B3; font-size: 12px; background-color: #ffffff }
  43. table { font: 12px Verdana,Tahoma; color: #000000 }
  44. input,select,textarea { font: 11px Verdana,Tahoma; color: #000000; font-weight: normal; background-color: #F3F6FA }
  45. select { font: 11px Verdana,Tahoma; color: #000000; font-weight: normal; background-color: #F3F6FA }
  46. .nav { font: 12px Verdana,Tahoma; color: #000000; font-weight: bold }
  47. .nav a { color: #000000 }
  48. .header { font: 11px Verdana,Tahoma; color: #FFFFFF; font-weight: bold; background-image: url("images/green/bg01.gif") }
  49. .header a { color: #FFFFFF }
  50. .category { font: 11px Verdana,Tahoma; color: #000000; background-color: #EFEFEF }
  51. .tableborder { background: #4D76B3; border: 0px solid #4D76B3 } 
  52. .singleborder { font-size: 0px; line-height: 0px; padding: 0px; background-color: #F3F6FA }
  53. .smalltxt { font: 11px Verdana,Tahoma }
  54. .outertxt { font: 12px Verdana,Tahoma; color: #000000 }
  55. .outertxt a { color: #000000 }
  56. .bold { font-weight: bold }
  57. .altbg1 { background: #F3F6FA }
  58. .altbg2 { background: #FFFFFF }
  59. --></style>
  60. <script language="JavaScript" src="images/common.js"></script>
  61. <style type="text/css" id="defaultPopStyle">.cPopText { font-family: Tahoma, Verdana; background-color: #FFFFCC; border: 1px #000000 solid; font-size: 12px; padding-right: 4px; padding-left: 4px; height: 20px; padding-top: 2px; padding-bottom: 2px; visibility: hidden; filter: Alpha(Opacity=80)}</style></head><body leftmargin="0" rightmargin="0" topmargin="0" onkeydown="if(event.keyCode==27) return false;"><div id="popLayer" style="position: absolute; z-index: 1000;" class="cPopText"></div>
  62. <script type="text/javascript">
  63. function check() {
  64. var selectedCategory = document.formModify.categoryId.options[document.formModify.categoryId.selectedIndex];
  65. var selectedValue = selectedCategory.value;
  66. if(selectedValue.split("|")[1] == "1") {
  67. alert("请选择第二级分类!");
  68. document.formModify.categoryId.focus();
  69. return false;
  70. } else {
  71. selectedCategory.value = selectedValue.split("|")[0];
  72. }
  73. return true;
  74. }
  75. </script>
  76. <br>
  77. <form method="post" name="formModify" action="ProductModify.jsp" onsubmit="return check()">
  78. <input type="hidden" name="action" value="add"/>
  79. <input type="hidden" name="id" value="<%=id %>"/>
  80. <table class="tableborder" align="center" cellpadding="4" cellspacing="1" width="97%">
  81. <tbody><tr>
  82. <td colspan="2" class="header">产品修改 - 必填内容</td>
  83. </tr>
  84. <tr>
  85. <td class="altbg1" width="21%">产品名称:</td>
  86. <td class="altbg2"><input name="name" size="25" maxlength="25" type="text" value="<%=p.getName()%>"> 
  87. </tr>
  88. <tr>
  89. <td class="altbg1">市场价格:</td>
  90. <td class="altbg2"><input name="normalPrice" size="25" type="text" value="<%=p.getNormalPrice()%>"></td>
  91. </tr><tr>
  92. <td class="altbg1">会员价格:</td>
  93. <td class="altbg2"><input name="memberPrice" size="25" type="text" value="<%=p.getMemberPrice()%>"></td>
  94. </tr>
  95. <tr>
  96. <td class="altbg1">所属类别</td>
  97. <td class="altbg2">
  98. <select name="categoryId">
  99. <%
  100. List<Category> categories = CategoryService.getInstance().getCategories();
  101. for(Iterator<Category> it = categories.iterator(); it.hasNext(); ) {
  102. Category c = it.next();
  103. String selected = "";
  104. if(c.getId() == p.getCategoryId()) selected = "selected";
  105. String preStr = "";
  106. for(int i=1; i<c.getGrade(); i++) preStr += "--";
  107. %>
  108. <option value="<%=c.getId()%>|<%=c.getGrade()%>" <%=selected%>><%=preStr + c.getName()%></option>
  109. <%
  110. }
  111.  %>
  112. </select>
  113. </td>
  114. </tr>
  115. <tr>
  116. <td class="altbg1" valign="top">产品描述:</td>
  117. <td class="altbg2"><textarea name="descr" cols="60" rows="5" id="descr"><%=p.getDescr()%></textarea></td>
  118. </tr>
  119. </tbody></table>
  120. <br>
  121. <center><input name="regsubmit" value="提 &nbsp; 交" type="submit"></center>
  122. </form>
  123. <script language="JavaScript">
  124. //document.register.username.focus();
  125. </script>
  126. </body></html>