|
@@ -1,6 +1,7 @@
|
|
|
package WebsiteES;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
+import java.util.List;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
@@ -12,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
|
import WebsiteES.Dao.UserDao;
|
|
|
import WebsiteES.myBatis.UserCart;
|
|
|
+import WebsiteES.myBatis.UserCartExample;
|
|
|
import WebsiteES.myBatis.Useraccount;
|
|
|
|
|
|
@Controller
|
|
@@ -43,7 +45,7 @@ public class WebApp {
|
|
|
{
|
|
|
if(email != null && password != null)
|
|
|
{
|
|
|
- if(password.length() <= 16 && password.length() > 8)
|
|
|
+ if(password.length() <= 16 && password.length() >= 8)
|
|
|
{
|
|
|
Useraccount user = UserDao.getUseraccountMapper().selectByPrimaryKey(email);
|
|
|
if(user != null)
|
|
@@ -67,4 +69,18 @@ public class WebApp {
|
|
|
return "register";
|
|
|
}
|
|
|
|
|
|
+ @RequestMapping("ShoppingCart")
|
|
|
+ public String cart(HttpSession session, Model model) throws IOException
|
|
|
+ {
|
|
|
+ Useraccount user = (Useraccount) session.getAttribute("user");
|
|
|
+ if(user != null)
|
|
|
+ {
|
|
|
+ UserCartExample example = new UserCartExample();
|
|
|
+ example.createCri
|
|
|
+ teria().andUserEmailEqualTo(user.getEmail());
|
|
|
+ List<UserCart> cart = UserDao.getUserCartMapper().selectByExample(example);
|
|
|
+ model.addAttribute("cart", cart);
|
|
|
+ }
|
|
|
+ return "ShoppingCart";
|
|
|
+ }
|
|
|
}
|