jsp页面显示

写的博客页面,在Servlet中能够显示出来,但是在jsp页面中就不能显示。

    public void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        HttpSession session=request.getSession();
        ArticleDao articleDao = new ArticleDao();
        List articleList=null;
        try {
            articleList = articleDao.queryArticle(-1,null);
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        request.setAttribute("articleList",articleList);
        RequestDispatcher rd=request.getRequestDispatcher("blog.jsp");
        rd.forward(request, response);
    }

jsp页面:

<%
    List articleList=(List)request.getAttribute("articleList");
    if(articleList==null||articleList.size()==0){
    %>
    <tr height="100"><td align="center"><li>博主目前未发表任何文章!</li></td></tr>
    <% 
    }
    else{
            int i=0;
            while(i<articleList.size()){
            ArticleBean articleSingle=(ArticleBean)articleList.get(i);
            %>
            <tr>
            <td class="tdg" style="text-indent:20" colspan="2">
            <a href="ArticleServlet?action=read&id=<%=articleSingle.getArt_id() %>">
                <b><%=articleSingle.getArt_title() %></b><br>
            </a>

            </td>
            </tr>
            <tr><td colspan="2" valign="top"><%=articleSingle.getArt_content() %></td></tr><br>
            <tr><td colspan="2">
                <a href="ArticleServlet?action=read&id=<%=articleSingle.getArt_id() %>">
                    阅读全文
                </a>
            </td>
            </tr>
            <tr>
                <td align="right" colspan="2">
                发表时间:<%=articleSingle.getArt_time() %>|
                评论:<%=articleSingle.getPl_count() %>|
                阅读:<%=articleSingle.getVote_count() %>次
                </td></tr>
                <tr height="1"><td background="red" colspan="2"></td></tr><br>
                <%
                    i++;
            }
    }
 %>
阅读 2.3k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
logo
101 新手上路
子站问答
访问
宣传栏