基于javaweb+jsp的蛋糕商城系统(java+JDBC+Servlet+HTML+A。。。基于javaweb+jsp的蛋糕商城系统(java+JDBC+Servlet+HTML+Ajax+mysql+Fileupload)
⼀、项⽬运⾏
环境配置:
Jdk1.8 + Tomcat8.5 + mysql + Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都⽀持)
项⽬技术:
Jdbc+ Servlert + html+ css + JavaScript + JQuery + Ajax + Fileupload等等
适⽤
课程设计,⼤作业,毕业设计,项⽬练习,学习演⽰等
public class AdminGoodsListServlet extends HttpServlet {
private GoodsService gService =new GoodsService();
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException { int type =0;//推荐类型
Parameter("type")!=null){
type=Integer.Parameter("type"));
}
int pageNumber =1;
Parameter("pageNumber")!=null){
try{
pageNumber=Integer.Parameter("pageNumber"));
}
catch(Exception e)
p = GoodsRecommendPage(type, pageNumber);
}
}
request.setAttribute("p", p);
request.setAttribute("type", type);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException { // TODO Auto-generated method stub
doGet(request, response);
}
}
⽤户登录控制层:
public class AdminUserListServlet extends HttpServlet {
private UserService uService =new UserService();
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException { int pageNumber =1;
Parameter("pageNumber")!=null){
try{
pageNumber=Integer.Parameter("pageNumber"));
}
catch(Exception e)
{
}
}
}
订单提交控制层:
@WebServlet(name ="order_submit",urlPatterns ="/order_submit")
html网页设计期末大作业public class OrderSubmitServlet extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException { }
protected void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException { Session().getAttribute("user")!=null){
}else{
request.setAttribute("failMsg","请登录后,再提交订单!");
}
}
}
后台管理员控制层:
@WebServlet(name ="admin_user_list",urlPatterns ="/admin/user_list")
public class AdminUserListServlet extends HttpServlet {
private UserService uService =new UserService();
/**
}else{
}
}
protected void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException { }
}
订单提交控制层:
@WebServlet(name ="order_submit",urlPatterns ="/order_submit")
public class OrderSubmitServlet extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException { }
protected void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException { Session().getAttribute("user")!=null){
}else{
request.setAttribute("failMsg","请登录后,再提交订单!");
}
}
}
后台管理员控制层:
}
}
request.setAttribute("p", p);
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)throws ServletException, IOException {
this.doGet(req, resp);
}
}
后台管理商品控制层:
@WebServlet(name ="admin_goods_list",urlPatterns ="/admin/goods_list")
public class AdminGoodsListServlet extends HttpServlet {
private GoodsService gService =new GoodsService();
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
}
后台管理商品控制层:
@WebServlet(name ="admin_goods_list",urlPatterns ="/admin/goods_list")
public class AdminGoodsListServlet extends HttpServlet {
private GoodsService gService =new GoodsService();
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException { int type =0;//推荐类型
Parameter("type")!=null){
type=Integer.Parameter("type"));
}
int pageNumber =1;
Parameter("pageNumber")!=null){
}
if(pageNumber<=0)
pageNumber=1;
Page p = UserPage(pageNumber);
TotalPage()==0)
{
p.setTotalPage(1);
p.setPageNumber(1);
}
else{
if(pageNumber>=p.getTotalPage()+1)
{
p = UserPage(pageNumber);
}
}
request.setAttribute("p", p);

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。