jsp首页的一些信息要从数据库里读取,我该怎么实现呢?

解决方案 »

  1.   

    不写了,抄过来算了!
    关键字: 首页数据加载 
    1、配置web.xml。欢迎页面为随便的一页面,不要配置为index.jsp 
    Xml代码 
    <welcome-file-list>  
          <welcome-file>a.jsp</welcome-file>  
    </welcome-file-list>   <welcome-file-list>
           <welcome-file>a.jsp</welcome-file>
     </welcome-file-list>2.在a.jsp页面中转发或重定向到一个action,在action中进行取值: 
    Html代码 
    <body>  
            <% response.sendRedirect("action"); %>  
    </body>  <body>
            <% response.sendRedirect("action"); %>
    </body>3、从action重定向index.jsp就可以了。这个方法我也觉得有点怪怪的!不过我也没找到类似asp.net 的page_load方法 呵!暂时这样解决吧