productvote.jsp
资源名称:shop.rar [点击查看]
上传用户:yatiankong
上传日期:2014-05-16
资源大小:5604k
文件大小:2k
源码类别:
Applet
开发平台:
Java
- <%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
- <jsp:useBean id="productvoteBean" class="MyFly.Bean.productvoteBean" scope="request"/>
- <%!
- String fun(String str)
- {
- try
- {
- return new String(str.getBytes("ISO8859_1"));
- }
- catch(Exception e)
- {
- return "";
- }
- }
- %>
- <%
- String proType=fun(request.getParameter("proType"));
- String productID=fun(request.getParameter("proNum").replace(',', '#'));
- String productvote=request.getParameter("productvote");
- if(productvoteBean.getNew(productID))
- {
- if(productvote.equals("best"))
- {
- productvoteBean.setGood(productvoteBean.getGood()+1);
- }
- else if(productvote.equals("good"))
- {
- productvoteBean.setBest(productvoteBean.getBest()+1);
- }
- else if(productvote.equals("middle"))
- {
- productvoteBean.setMiddle(productvoteBean.getMiddle()+1);
- }
- else
- {
- productvoteBean.setBad(productvoteBean.getBad()+1);
- }
- productvoteBean.update();
- }
- else
- {
- productvoteBean.setProductID(productID);
- if(productvote.equals("best"))
- {
- productvoteBean.setGood(1);
- }
- else if(productvote.equals("good"))
- {
- productvoteBean.setBest(1);
- }
- else if(productvote.equals("middle"))
- {
- productvoteBean.setMiddle(1);
- }
- else
- {
- productvoteBean.setBad(1);
- }
- productvoteBean.addNew();
- }
- String url="listbook.jsp?proType="+proType+"&proNum="+productID.replace('#', ',');
- String u="<script language=javascript>alert('用户投票成功');javascript:location.href='"+url+"';</script>";
- out.println(u);
- %>