-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdoAdd.jsp
More file actions
19 lines (19 loc) · 879 Bytes
/
doAdd.jsp
File metadata and controls
19 lines (19 loc) · 879 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<%@ page import="db.DAO,java.util.*,java.text.SimpleDateFormat" errorPage="addcatch.jsp" isErrorPage="false" buffer="12kb" autoFlush="true" %>
<%
int cid=Integer.parseInt(request.getParameter("cid"));
String cname=request.getParameter("cname");
String duration=request.getParameter("duration");
float price=Float.parseFloat(request.getParameter("price"));
String discount=request.getParameter("discount");
String start_date=request.getParameter("start_date");
String end_date=request.getParameter("end_date");
SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd");
String ann_date=df.format(new Date());
DAO dao=new DAO();
if(dao.addCourse(cid,cname,price,duration,discount,start_date,ann_date,end_date))
{ response.sendRedirect("course.jsp?msg=yes");
}
else
{ response.sendRedirect("course.jsp?msg=no");
}
%>