时间:2023-09-20 14:36:01 | 来源:网站运营
时间:2023-09-20 14:36:01 来源:网站运营
在线蛋糕商城销售网站项目【SpringMvc+mybatis+bootstrap等实现】:前言:主要功能说明用户角色:包含以下功能:查看所有蛋糕,用户登录和注册,查看蛋糕详情,提交订单,查看我的订单,查看我的购物车,确认收货,评价等功能。
功能截图:登陆注册:
package com.smzy.controller; import com.smzy.pojo.User;import com.smzy.service.UserService;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Controller;import org.springframework.ui.Model;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RequestParam; import javax.servlet.http.HttpSession;import java.util.HashMap;import java.util.List;import java.util.Map; @Controller@RequestMapping("/admin")public class UserController { @Autowired private UserService userService; @RequestMapping("/listUser") public String findAll(Model model) { List<User> users = userService.findAll(); model.addAttribute("users",users); return "admin/listUser"; } @RequestMapping("/editUser") public String edit(Model model ,Integer id) { User user = userService.get(id); model.addAttribute("user",user); return "admin/editUser"; } @RequestMapping("/updateUser") public String update(Integer id,String password) { userService.updatePassword(id,password); return "redirect:listUser"; } }
package com.smzy.service; import com.smzy.pojo.User; import java.util.List; public interface UserService { List<User> findAll(); User get(Integer id); void updatePassword (Integer id ,String password); User get(String name,String password); boolean isExist(String name); void add(User user);}
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"> <context:component-scan base-package="com.smzy.controller"/> <mvc:annotation-driven/> <mvc:default-servlet-handler/> <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/> <property name="prefix" value="/WEB-INF/views/"/> <property name="suffix" value=".jsp"/> </bean> <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"/> <mvc:interceptors> <mvc:interceptor> <mvc:mapping path="/*"/> <bean class="com.smzy.interceptor.LoginInterceptor"/> </mvc:interceptor> <mvc:interceptor> <mvc:mapping path="/*"/> <bean class="com.smzy.interceptor.OtherInterceptor"/> </mvc:interceptor> </mvc:interceptors></beans>
关键词:实现,项目,蛋糕,商城,销售