从新闻条目页面传递相同ID到相应的详细新闻页面,详细新闻页面如何接收呢,我用一个类封装了request,(因为在JSP页中不能有JAVA代码),在详细新闻页面我用:
<%
   NewsBean bean = new NewsBean(request);%>
<%               
   if(news != null ){
   %>
<table width="531" border="0" cellpadding="0" cellspacing="0">
                    <tr> 
                      <td height="25" align="center" bgcolor="#895F39" class="bai9"><span class="bai"><%=news.getTitle() %></span></td>
                    </tr>
                    <tr align="right" valign="bottom"> 
                      <td width="347" height="35" class="zhi"><%=news.getAuthor() %></td>
                      <td width="184" class="zhi"><%=news.getAddtime() %></td>
                    </tr>
                    <tr> 
                      <td class="zhi"><p class="dazhi"><br><%=news.getContents() %>
               <br>
                       
                          </td>
                    </tr>
                  </table>
<%
         }
      %>
错误:news不能解析,要如何定义news呢,谢谢大家帮帮忙!!!

解决方案 »

  1.   

    <page import="news类的路径">
      

  2.   

    news 是什么呀 压根一没定义的变量 是bean吧
      

  3.   

    <%
       NewsBean bean = new NewsBean(request);%>
    <%               
       if(bean != null ){
       %>
    <table width="531" border="0" cellpadding="0" cellspacing="0">
                        <tr> 
                          <td height="25" align="center" bgcolor="#895F39" class="bai9"><span class="bai"><%=news.getTitle() %></span></td>
                        </tr>
                        <tr align="right" valign="bottom"> 
                          <td width="347" height="35" class="zhi"><%=bean .getAuthor() %></td>
                          <td width="184" class="zhi"><%=bean .getAddtime() %></td>
                        </tr>
                        <tr> 
                          <td class="zhi"><p class="dazhi"><br><%=news.getContents() %>
                   <br>
                           
                              </td>
                        </tr>
                      </table>
    <%
             }
          %>
    我猜楼主是这意思!
      

  4.   

    bean不是变量啊, NewsBean是我封装的request类,因为这个页面是从新闻条目页面通过ID传过来的
      

  5.   

    NewsBean只是request类,传的ID,没有定义显示的详细内容,所以是错的