<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page isELIgnored="false" %> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
  <head>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">    
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
    <LINK href="<%=path %>/css/css.css" type=text/css rel=stylesheet>
    <script type="text/javascript" src="<%=path %>/js/popup.js"></script>
  </head>
  
  <BODY text=#000000  leftMargin=0 topMargin=0>
<div class="wrap"> 
<TABLE  cellSpacing=0 cellPadding=0 width="100%" align=center border=0  background="<%=path %>/img/reservation01.gif">
<TR height="90">
<TD align="center">
    <jsp:include flush="true" page="/qiantai/inc/incTop1.jsp"></jsp:include> 
</TD>
</TR>
</TABLE>


<TABLE id=guide cellSpacing=0 cellPadding=0 width="100%" align=center border=0>
<TR>
<TD align="left">
<jsp:include flush="true" page="/qiantai/inc/incTop2.jsp"></jsp:include>
</TD>
</TR>
</TABLE>
        <TABLE cellSpacing=0 cellPadding=0 width="100%" align=center border=0>
<TR height="3">
<TD align="left"></TD>
</TR>
</TABLE>
        <c:forEach items="${requestScope.mealList}" var="meal">
    <table align="center" rules="none" border="1" width="100%" cellspacing="0" cellpadding="3" bordercolor="lightgrey" bordercolorlight="lightgrey" bordercolordark="white">
<tr height="30">
<td style="text-indent:5" background="<%=path %>/img/classT.jpg">
<span style="float:left;color: white;font-size: 11px;">
   <b>${meal.mealName}</b>
</span>
</td>
</tr>
<tr bgcolor="#F9F9F9">
<td height="60" align="center">
<table border="1" width="100%" cellspacing="0" cellpadding="0" bgcolor="#F9F9F9" bordercolor="#EEEEEE" bordercolorlight="#EEEEEE" bordercolordark="white" rules="cols">
<tr height="20" align="center" bgcolor="#F4F4F4">
              <td width="5%"></td>
              <td width="50%" style="font-size: 11px;">菜品名称</td>
              <td width="5%" style="font-size: 11px;">菜品单价</td>
        </tr>
<c:forEach items="${meal.mealList}" var="meal">
<tr height="30" align="center">
<td>
<img src="<%=path %>/img/boardPic.jpg">
</td>
<td align="left" style="font-size: 11px;">
<img src="<%=path %>/img/btitle.jpg">
<a href="<%=path %>/meal?type=mealDetail&mealNo=${meal.mealNo}">${meal.mealName}</a>
</td>
<td style="font-size: 11px;">
${meal.price}
</td>

</tr>
</c:forEach>
</table>
</td>
</tr>
</table>
<table><tr><td></td></tr></table>
</c:forEach>
<jsp:include flush="true" page="/qiantai/inc/incFoot.jsp"></jsp:include>
    </div>
  </BODY>
</html></html>

解决方案 »

  1.   


     为什么   <c:forEach items="${requestScope.mealList}" var="meal">
        <table align="center" rules="none" border="1" width="100%" cellspacing="0" cellpadding="3" bordercolor="lightgrey" bordercolorlight="lightgrey" bordercolordark="white">
    <tr height="30">
    <td style="text-indent:5" background="<%=path %>/img/classT.jpg">
    <span style="float:left;color: white;font-size: 11px;">
       <b>${meal.mealName}</b>
    </span>
    </td>
    </tr>
    <tr bgcolor="#F9F9F9">
    <td height="60" align="center">
    <table border="1" width="100%" cellspacing="0" cellpadding="0" bgcolor="#F9F9F9" bordercolor="#EEEEEE" bordercolorlight="#EEEEEE" bordercolordark="white" rules="cols">
    <tr height="20" align="center" bgcolor="#F4F4F4">
                  <td width="5%"></td>
                  <td width="50%" style="font-size: 11px;">菜品名称</td>
                  <td width="5%" style="font-size: 11px;">菜品单价</td>
            </tr>
    <c:forEach items="${meal.mealList}" var="meal">
    <tr height="30" align="center">
    <td>
    <img src="<%=path %>/img/boardPic.jpg">
    </td>
    <td align="left" style="font-size: 11px;">
    <img src="<%=path %>/img/btitle.jpg">
    <a href="<%=path %>/meal?type=mealDetail&mealNo=${meal.mealNo}">${meal.mealName}</a>
    </td>
    <td style="font-size: 11px;">
    ${meal.price}
    </td>这段代码是没用的 开发工具中是这样子的代码 
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
    <html>
      <head>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
        <LINK href="/bbs/css/css.css" type=text/css rel=stylesheet>
        <script type="text/javascript" src="/bbs/js/popup.js"></script>
        <script type="text/javascript">
        function zhutiAdd(catelog_id)
        {
               
               alert("请先登录");
            
            
        }
        </script>
      </head>
      
      <BODY text=#000000  leftMargin=0 topMargin=0>
    <div class="wrap"> 
    <TABLE  cellSpacing=0 cellPadding=0 width="100%" align=center border=0  background="/bbs/img/reservation01.gif">
    <TR height="90">
    <TD align="center">
        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
          <script type="text/javascript">
          </script>
      </head>
      
      <body>
           <br><font size="22px;">网上订餐主题论坛网站</font> 
      </body>
    </html>
     
    </TD>
    </TR>
    </TABLE>


    <TABLE id=guide cellSpacing=0 cellPadding=0 width="100%" align=center border=0>
    <TR>
    <TD align="left">

     <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
          <script language="JavaScript" src="/bbs/js/public.js" type="text/javascript"></script>
          <script type='text/javascript' src='/bbs/dwr/interface/loginService.js'></script>
          <script type='text/javascript' src='/bbs/dwr/engine.js'></script>
          <script type='text/javascript' src='/bbs/dwr/util.js'></script>
          <script type="text/javascript">
             function admin()
             {
                var url="/bbs/login.jsp";
                window.open(url,"_blank");
             }
     
             function reg()
            {
                    var url="/bbs/qiantai/userinfo/userReg.jsp";
                    var n="";
                    var w="480px";
                    var h="500px";
                    var s="resizable:no;help:no;status:no;scroll:yes";
        openWin(url,n,w,h,s);
            }
            
            function check()
    {                                                                                         
         if(document.ThisForm.userName.value=="")
     {
      alert("请输入用户名");
    return false;
     }
     if(document.ThisForm.userPw.value=="")
     {
      alert("请输入密码");
    return false;
     }
     document.getElementById("indicator").style.display="block";
     loginService.login(document.ThisForm.userName.value,document.ThisForm.userPw.value,document.ThisForm.userType.value,callback);
    }

    function callback(data)
    {
        document.getElementById("indicator").style.display="none";
        if(data=="no")
        {
            alert("用户名或密码错误");
        }
        if(data=="yes")
        {   alert("登陆成功");
            window.location.reload();
        }
        
    }
          </script>
      </head>
      
      <body>
      <form action="" name="ThisForm" method="post">
       <A href="/bbs/catelog?type=catelogAll">首 页</A> &nbsp;&nbsp;
       
            
            用户名:<input class="input" title="用户名不能为空" size="11" name="userName" type="text" />
            密 码:<input class="input" title="密码不能为空" type="password" size="11" name="userPw"/>
            登陆身份:
           <select name="userType" style="width: 80px">
                   <option value="1">普通用户</option>
                   <option value="100">论坛管理员</option>
               </select>
               <input type="button" value="登  录" onclick="check()" style="border:#ccc 1px solid; background-color:#FFFFFF; font-size:12px; padding-top:3px;" />
       &nbsp;
       <input type="button" value="注  册" onclick="reg()" style="border:#ccc 1px solid; background-color:#FFFFFF; font-size:12px; padding-top:3px;" />
               &nbsp;
               
               
               
               <img id="indicator" src="/bbs/img/loading.gif" style="display:none"/>
               <a href="/bbs/news?type=newsAll">公告</a> &nbsp;&nbsp;
               <a href="/bbs/qiantai/dingcan/mealAll.jsp">订餐</a> &nbsp;&nbsp;
               <a href="/bbs/Untitled-3.html">首页</a> &nbsp;&nbsp;
       <a href="#" onclick="admin()">后台管理</a> &nbsp;&nbsp;
      </form>
      </body>
    </html> </TD>
    </TR>
    </TABLE>
            <TABLE cellSpacing=0 cellPadding=0 width="100%" align=center border=0>
    <TR height="3">
    <TD align="left"></TD>
    </TR>
    </TABLE>
            

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
      </head>
      
      <body>
            <TABLE id=footer cellSpacing=0 cellPadding=0 width="100%" align=center border=0>
                 <TR>
                      <TD align=middle><DIV align=center>建议使用IE6.0或以上版本浏览 <br>&nbsp;&nbsp;&nbsp;</DIV></TD>
                 </TR>
            </TABLE>
      </body>
    </html>    </div>
      </BODY>
    </html></html>
      

  2.   

    第一,你是《神探狄仁杰》的粉丝么?
    第二,没用,是啥意思呢?是<c:forEach>标签没用,还是页面上无数据显示(如果这样,那应该是你的meanList没取到值呗)
      

  3.   

    额   是这样的   页面上没有数据产生的   可是为什么meallist没能取到值呢 我查过很多次了 不应该啊 可是IE里面的开发工具里面代码的<c:forEach>标签那段为什么都没有了  也可能是<c:forEach>标签没用的吧   !! 难道说meallist没有数据<c:forEach>标签也没用吗
      

  4.   

    public void mealDetail(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
    {
    List mealList=new ArrayList();
    int mealNo=Integer.parseInt(req.getParameter("mealNo"));
    String sql="select * from t_meal where del='no' and mealNo="+mealNo;
    Object[] params={};
    DB mydb=new DB();
    try
    {
    mydb.doPstm(sql, params);
    ResultSet rs=mydb.getRs();
    while(rs.next())
    {
    Tmeal meal=new Tmeal();

    meal.setMealNo(rs.getInt("mealNo"));
    meal.setMealName(rs.getString("mealName"));
    meal.setPrice(rs.getString("price"));
    meal.setMealList(liuService.getMealListAll(rs.getInt("mealNo")));

    mealList.add(meal);
        }
    rs.close();
    }
    catch(Exception e)
    {
    e.printStackTrace();
    }
    mydb.closed();

    req.setAttribute("mealList", mealList);
    req.getRequestDispatcher("qiantai/dingcan/mealDetail.jsp").forward(req, res);
    }
    servlet中关于这一段的代码是这样子的