⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 detailorder.java

📁 jsp+struct网上订票系统
💻 JAVA
字号:
package business;
import java.util.Iterator;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspWriter;
import dao.DetailOrderDao;
import orm.Flight;
import orm.OrderItem;
import orm.ShopItem;
import orm.Order;
import javax.servlet.http.HttpSession;
public class DetailOrder{
	private DetailOrderDao detailorderdao;
	public DetailOrderDao getDetailorderdao()
	{
		return detailorderdao;
	}
	public void setDetailorderdao(DetailOrderDao detailorderdao)
	{
		this.detailorderdao=detailorderdao;
	}
	
	public void list(HttpServletRequest request,JspWriter out)
	throws Exception{
		List list=null;
		
        list=(List)request.getSession().getAttribute("detailorder");
         Long orderid=(Long)request.getSession().getAttribute("orderid");
		if(list==null)
		{
			out.print("订单内容为空");
			return;
		}
	
		int count=0;
		Iterator it=list.iterator();
		ShopItem item=null;
	
		
		Order order=null;
		double totalmoney=0;
		out.print(" <table width=90% border=0 cellspacing=0 cellpadding=0>"+
		"<tr bgcolor=#3399FF><td align=center>"+orderid+"号订单情况如下</td></tr>"+
		
        "<tr bgcolor=#0099FF>" + 
        "<td >"+
        " <table width=100% border=0 cellspacing=0 cellpadding=0>"+
        "<tr bgcolor=#0099FF>" + 
        
        "<td width=10%>编号 </td>"+     
        "<td width=10%>航班号</td>"+
        "<td width=15% >出发日期</td>"+
        "<td width=15% >单价</td>"+
        "<td width=15%>订购数量</td>"+
        "<td width=15%>实购数量</td>"+
        "<td width=10%>总价</td>"+
        "<td width=10%>备注</td>"+
       
               "</tr>" 
				);
		while(it.hasNext()){
			
		 item=(ShopItem)it.next();
		 order=(Order)item.getOrder();
		
		out.print("<tr>"+
	    "<td>"+item.getLinenum()+"</td>"+
	    "<td>"+item.getItem().getFlight().getFlight_no()+"</td>"+
	    "<td>"+item.getItem().getDate()+"</td>"+
	    "<td>¥"+item.getPrice()+"</td>"+
	    "<td>"+item.getShopcount()+"</td>"+
	    "<td>"+item.getRealcount()+"</td>"+
	    "<td>"+(item.getRealcount()*item.getPrice())+"</td>"
	    );
		
		if(item.getRealcount()==0)
		{
			out.print( "<td>缺票</td>");
			
			out.print("</tr>");
		}
		else if(item.getRealcount()<item.getShopcount())
		{
			out.print( "<td>缺票"+(item.getShopcount()-item.getRealcount())+"张</td>");
			
			out.print("</tr>");
		}
		else
		{
			out.print( "<td>有票</td>");
			
			out.print("</tr>");
		}
		totalmoney=totalmoney+item.getRealcount()*item.getPrice();
		count++;
}
				
		out.print("</table>");
		out.print("</td><tr>");
		out.print( "<tr><td align=right>总金额为¥"+totalmoney+"</tr></td>");
		out.print("</table>");
	
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -