productremark.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="productremarkBean" class="MyFly.Bean.productremarkBean" scope="request"/>
- <%@ page import="java.util.Date,java.text.SimpleDateFormat"%>
- <%
- request.setCharacterEncoding("GB2312");
- %>
- <%!
- String fun(String str)
- {
- try
- {
- return new String(str.getBytes("ISO8859_1"));
- }
- catch(Exception e)
- {
- return "";
- }
- }
- %>
- <%
- String proType=fun(request.getParameter("proType"));
- String productID=request.getParameter("proNum").replace(',', '#');
- String title=request.getParameter("title");
- String content=request.getParameter("content");
- SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd");//将显示"1999-10-1 21:03:10"的格式.
- Date currentTime_1 = new Date();
- String appendTime = formatter.format(currentTime_1);
- //String name=(String)session.getAttribute("name");
- //if(name == null)
- //{
- // out.println("<Script language=JavaScript>alert('请登陆后评论!');location.href='index.jsp';</Script>");
- //}
- if(title == null || title.equals("") || title == "")
- {
- out.println("<Script language=JavaScript>alert('请填写标题');JavaScript:history.back();</Script>");
- }
- if(content == null || content.equals("") || content == "")
- {
- out.println("<Script language=JavaScript>alert('请填写内容');JavaScript:history.back();</Script>");
- }
- productremarkBean.setProductID(productID);
- productremarkBean.setTitle(title);
- productremarkBean.setContent(content);
- productremarkBean.setAppendTime(appendTime);
- productremarkBean.addNew();
- String url="listbook.jsp?proType="+proType+"&proNum="+productID.replace('#', ',');
- String u="<script language=javascript>alert('用户发表成功');javascript:location.href='"+url+"';</script>";
- out.println(u);
- %>