jsp的技术教程

源代码在线查看: submit_order.jsp

软件大小: 698 K
上传用户: srbrabbit
关键词: jsp 技术教程
下载地址: 免注册下载 普通下载 VIP

相关代码

				
				
				
								if(session.getAttribute("username")==null||session.getAttribute("username")=="")
				{
					response.sendRedirect("../member/login.jsp?url="+request.getRequestURI());
				}
				
				
				%>
								public String getStr(String str)
				{
					try
					{
						String temp_p=str;
						byte[] temp_t=temp_p.getBytes("ISO8859-1");
						String temp=new String(temp_t);
						return temp;
					}
					catch(Exception e)
					{
					 
					}
					return "null";
				}
				%>        
								public String getStr2(String str)
				{
					try
					{
						String temp_p=str;
						byte[] temp_t=temp_p.getBytes("GBK");
						String temp=new String(temp_t,"ISO8859_1");
						return temp;
					}
					catch(Exception e)
					{
					 
					}
					return "null";
				}
				%>        
								String t_address,t_tel;
				String address,tel;
				t_address=request.getParameter("address");
				t_tel=request.getParameter("tel");
				
				address=getStr(t_address);
				tel=getStr(t_tel);
				
				 String sqlinsert="update orders set user_address='"+address+"',user_tel='"+tel+"' where user_name='"+session.getAttribute("username")+"'";
				// 	out.println(sqlinsert);
				workM.executeQuery(sqlinsert);
				
				%>             
				
				
				[详细资料]
				
				
				
				
				
				订单信息确认
				
				   
				     
				      订单信息
				    
				  
				   
				    姓名:
				    
				  
				   
				    住址:
				     
				      
				    
				  
				   
				    电话:
				     
				
				
				    
				  
				 
				
				      
				
				  您的购物车中包含以下货物:
				  
				     
				       
				        购买数量
				      
				       
				        书名
				      
				       
				        单价
				      
				       
				        总价格
				      
				    
										//价格
					double g_price,total_price;
					g_price=0;
					total_price=0;
					//********
					String sqlList="select * from orders where user_name='"+session.getAttribute("username")+"' and status=0";
					ResultSet RSList=workM.executeQuery(sqlList);
					try
					{
						while(RSList.next())
						{
							int b_num;
							b_num=RSList.getInt("book_number");
					%>
				     
				       
				          
				          
				          
				      
					  					  	String sqlBook="select book.* from book where id="+RSList.getInt("book_id");
						ResultSet RSBook=workM.executeQuery(sqlBook);
						while(RSBook.next())
						{
							
					  %>
				       
				        
				      
				       
					  					  	double price;
						price=RSBook.getDouble("price");
					  %>
				        ¥
				      
					 
				       
				        ¥
				      
					   					   g_price=g_price+(double)price*b_num;
					   }%>
				    
				   
											}
					}
					catch(Exception e)
					{
					}
					%>
					  
				       
				        货物价格
				      
				       
				        ¥
				      
				    
				     
				        
				         
				        运输费用
				      
				       
				        ¥5.00
				      
				    
				     
				       
				        总费用
				      
				       
				        ¥
				      
				    
					  
				       
					
				    关闭窗口|打印该页
				
				  
				    
				  
				 
				   
				
				
				
				
							

相关资源