List; } boolean deleteDishById (int dishId) {dishDao.deleteDish (dishId);
} public boolean editDish (Dish dish) {dishDao.editDish (dish);
} public boolean addDish (Dish dish) {dishDao.addDish (dish); }}
()
1. Discount.xsl
lt; xsl: stylesheet version= 1.0 xmlns: xsl= http: //w3/1999/XSL/Transformraquo; gt;
lt; xsl: output method= xml indent= yes / gt;
lt; xsl: template match=/ gt;
lt; html gt;
lt; body gt;
lt; p gt;: lt;/p gt;
lt; table border= 1 align= left gt;
lt; tr gt;
lt; td gt; * lt;/td gt;
lt; td gt; lt;/td gt;
lt;/tr gt;
lt; xsl: for-each select= list gt;
lt; xsl: for-each select= discount gt;
lt; tr gt;
lt; td gt;
lt; xsl: value-of select= amount / gt;
lt;/td gt;
lt; td gt;
lt; xsl: value-of select= percent / gt;
lt;/td gt;
lt;/tr gt;
lt;/xsl: for-each gt;
lt;/xsl: for-each gt;
lt;/table gt;
lt; p gt; * -, lt;/p gt;
lt;/body gt;
lt;/html gt;
lt;/xsl: template gt;
lt;/xsl: stylesheet gt;
2. Dish.jsp
lt; html gt;
lt; head gt;
lt; meta http-equiv= Content-Type content= text/html; charset=UTF - 8 gt;
lt; title gt; lt;/title gt;
lt; link rel= stylesheet type= text/css href= main.css / gt;
lt;% @ taglib uri= http: //java.sun/jsp/jstl/coreraquo; prefix= c % gt;
lt; script type= text/javascript src= jsp/countCheck.js gt; lt;/script gt;
lt;/head gt;
lt; body gt;
lt; div gt;
lt; jsp: include page= mainPages/header.jsp flush= true / gt;
lt; jsp: include page= mainPages/left.jsp flush= true / gt;
lt; jsp: include page= mainPages/right.jsp flush= true / gt;
lt; div gt;
lt; form action= Controller method= post gt;
lt; table style= border-color: tomato; background-color: #ffffff; font-size: medium; gt;
lt; c: if test= $ {dish_data!= Sorry, information was not found } gt;
lt; c: forEach var= dishDO items= $ {dish_data} gt;
lt; tr gt;
lt; td gt; lt; input type= checkbox name= checkBox $ {dishDO.dish.name} / gt; lt; br/ gt;
lt; input type= text maxlength= 3 size= 1 onmouseout= return check (count $ {dishDO.dish.name}) name= count $ {dishDO.dish.name} value= 1 / gt;
lt;/td gt;
lt; td align= center gt;
lt; img alt= src= $ {dishDO.dish.imagePath} / gt;
lt;/td gt;
lt; td align= center style= color: chocolate gt;
lt; c: out value= $ {dishDO.dish.name} / gt;
lt;/td gt;
lt; td align= center gt;
lt; c: out value= $ {dishDO.dish.weight} / gt;
lt;/td gt;
lt; td align= center gt;
lt; c: out value= $ {dishDO.dish.price} / gt;
lt;/td gt;
lt; td align= center gt;
lt; c: forEach var= dishComp items= $ {dishDOposition} gt;
lt; c: out value= $ {dishComp.productName} / gt;
lt; c: out= $ {dishComp.productWeight} / gt; lt; br/ gt;
lt;/c: forEach gt;
lt;/td gt;
lt;/tr gt;
lt;/c: forEach gt;
lt;/c: if gt;
lt;/table gt;
lt; input type= submit value= / gt;
lt; input type= hidden name= command value= addToBasket / gt;
lt;/form gt;
lt;/div gt;
lt; jsp: include page= mainPages/footer.jsp flush= true / gt;
lt;/div gt; lt;/body gt; lt;/html gt;
3. IDishDao.javainterface IDishDao {boolean addDish (Dish dish);// Boolean deleteDish (int dishId);// Boolean editDish (Dish dish);// List lt; Dish gt; selectDishes ();// ArrayList lt; Dish gt; selectDishesByDishType (String dishType); List lt; DishComposition gt; selectDishCompositionByDishId (int dishId);}
4. DishDaoImpl.javaDishDaoImpl () {= new DBConnection (); } Boolean addDish (Dish dish) {{= (PreparedStatement) dbConnection.connect (). PrepareStatement (Dish.getMap (). Get ( addDish )) ;. setInt (1, dish.getId ()) ;. setString (2, dish.getName ()) ;. setDouble (3, dish.getWeight ()) ;. setDouble (4, dish.getPrice ()) ;. setLong (5, dish.getType (). getId ()); (statement.executeUpdate () gt; 0);
} catch (SQLException e) {.printStackTrace (); false;
}} boolean deleteDish (int dishId) {{= (PreparedStatement) dbConnection.connect (). prepareStatement (Dish.getMap (). get ( deleteDish )) ;. setInt (1, dishId); (statement.executeUpdate () gt; 0);
} catch (SQLException ex) {.g...